简体   繁体   中英

How to get correct screen resolution?

My laptop screen resolution is 1920 * 1080. But the following calls gives a different resolution - 1280 * 720. How can I get the correct screen resolution? I use Windows 10

int height = Screen.PrimaryScreen.Bounds.Height;
int width = Screen.PrimaryScreen.Bounds.Width;

width = SystemInformation.VirtualScreen.Width;
height = SystemInformation.VirtualScreen.Height;

Your approach is almost correct with the first one.

Here is how you should code it

        int height = Screen.PrimaryScreen.Bounds.Size.Height;
        int width = Screen.PrimaryScreen.Bounds.Size.Width;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM