【发布时间】:2018-06-16 18:37:54
【问题描述】:
我需要屏幕 DPI,以便我可以相应地调整我的程序。
所以我的问题是如何使用 VB.NET 检测屏幕 DPI?
【问题讨论】:
-
WPF 还是 WinForms? For WPF, see here
我需要屏幕 DPI,以便我可以相应地调整我的程序。
所以我的问题是如何使用 VB.NET 检测屏幕 DPI?
【问题讨论】:
试试这个:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim g As Graphics = Me.CreateGraphics()
MessageBox.Show("ScreenWidth:" & Screen.PrimaryScreen.Bounds.Width & " ScreenHeight:" & Screen.PrimaryScreen.Bounds.Height & vbCrLf & " DpiX:" & g.DpiX & " DpiY:" & g.DpiY)
End Sub
【讨论】: