Reputation: 159
I need the screen DPI so i can adjust my program accordingly.
So my question is How to detect the screen DPI using VB.NET?
Upvotes: 1
Views: 4699
Reputation: 162
try this:
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
Upvotes: 2