how to find the screen resolution

  • Thread starter Thread starter active
  • Start date Start date
A

active

I've been looking for a way to determine the DPI (PPI) of the screen.

I've found often the suggestion to use:

Dim height As Integer = My.Computer.Screen.Bounds.Height

Dim width As Integer = My.Computer.Screen.Bounds.Width

but that gives the total number of pixels not the DPI (which is usually 96
for pc's).



Can you tell me how to the DPIX and DPIY?





Thanks
 
I've been looking for a way to determine the DPI (PPI) of the screen.

I've found often the suggestion to use:

Dim height As Integer = My.Computer.Screen.Bounds.Height

Dim width As Integer = My.Computer.Screen.Bounds.Width

but that gives the total number of pixels not the DPI (which is usually 96
for pc's).

Can you tell me how to the DPIX and DPIY?

Thanks
Try this:

Dim dspGraphics As Graphics
dspGraphics = Me.CreateGraphics ' Graphics for user's display
MsgBox(dspGraphics.DpiY)
MsgBox(dspGraphics.DpiX)
dspGraphics.Dispose()
 
Works for me!

Thanks


redear said:
Try this:

Dim dspGraphics As Graphics
dspGraphics = Me.CreateGraphics ' Graphics for user's display
MsgBox(dspGraphics.DpiY)
MsgBox(dspGraphics.DpiX)
dspGraphics.Dispose()
 
I had seen that before I posted but as far as I could tell it only showed
how to get the screen bounds (which is the size) not the DPI.

thanks
 
Back
Top