How to get the Screen DPI ?? 
Author Message
 How to get the Screen DPI ??

I need my app to bail if the screen dpi isn't 96.  How do you do this in .net?

in VB6 it was easy :)

Thanks



Tue, 08 Feb 2005 04:45:33 GMT  
 How to get the Screen DPI ??

Quote:
> I need my app to bail if the screen dpi isn't 96.  How do you do
> this in .net?

> in VB6 it was easy :)

Have a look at the properties Dpix/dpiy of the graphics object.

Armin



Tue, 08 Feb 2005 07:08:35 GMT  
 How to get the Screen DPI ??

Quote:

> I need my app to bail if the screen dpi isn't 96.  How do you do this in .net?

> in VB6 it was easy :)

> Thanks

Hi

Make a new Windows Project, with a form called Form1 and a button
called Button1. Paste the following code into the click event of the
button:

        ' Get handle to form.
        Dim hwnd As New IntPtr()
        hwnd = Me.Handle ' any WinForm will do.

        ' Create new graphics object using handle to window.
        Dim g As Graphics = Graphics.FromHwnd(hwnd)

        ' Draw rectangle to screen.
        MsgBox("DpiX: " & g.DpiX.ToString & "; DpiY: {1}: " &
g.DpiY.ToString)

        ' Dispose of new graphics.
        g.Dispose()

Regards,
Joergen Bilet Gude



Tue, 08 Feb 2005 15:29:47 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Increased DPI screen

2. IE 6 scaling on higher DPI screens

3. Getting X and Y DPI

4. How know dpi of image

5. dpi of a jpeg

6. how to save a JPG Image with resolution 72 or 150 DPI

7. FONT DPI detection

8. Custom DPI settings mess up Statusbar, Coolbar, and other ActiveX controls

9. dpi of bitmap/jpeg

10. Twips, Pixel, DPI,....

11. Handling DPI changes in my vb6 app

12. How know dpi of image

 

 
Powered by phpBB® Forum Software