I'm trying to get current screen resolution using Screen.PrimaryScreen.Bounds
. My screen resolution is 1920 X 1080 current, and its scale is 125%.
I've used DPI settings (Screen.PrimaryScreen.Bounds.Height * (int)myForm.CreateGraphics().DpiY) / 96
and Screen.FromControl(myForm).WorkingArea.Height
, but it returns the same value of Screen.PrimaryScreen.Bounds
. How can I get the value 1980 X 1920, or get screen scale 125%? I think both ways are valid.
Asked
Active
Viewed 1,311 times
2
-
I've tried it, but it also returns the same value with ``(Screen.PrimaryScreen.Bounds.Height * (int)myForm.CreateGraphics().DpiY) / 96``. – Inkyu Lee Nov 06 '18 at 04:02
-
Posted a few days ago: [Using SetWindowPos with multiple monitors](https://stackoverflow.com/questions/53012896/c-sharp-user32-using-setwindowpos-with-multiple-monitors?answertab=active#tab-top). This answer supposes that your application is DPIAware. Is it? Otherwise, you'll always get a 96Dpi *virtualized* **Size** and **Resolution** (two different things). In case, see: [Configure an app to run correctly on a machine with a high DPI setting](https://stackoverflow.com/questions/13228185/how-to-configure-an-app-to-run-correctly-on-a-machine-with-a-high-dpi-setting-e?answertab=active#tab-top) – Jimi Nov 06 '18 at 04:35
1 Answers
-2
foreach (var screen in System.Windows.Forms.Screen.AllScreens)
{
Console.WriteLine("Device Name: " + screen.DeviceName);
Console.WriteLine("Bounds: " +
screen.Bounds.ToString());
Console.WriteLine("Type: " +
screen.GetType().ToString());
Console.WriteLine("Working Area: " +
screen.WorkingArea.ToString());
Console.WriteLine("Primary Screen: " +
screen.Primary.ToString());
}

Eranga Gamagedara
- 536
- 1
- 3
- 10
-
It does not work with Windows 10 when Zoom level is changed to other than 100% – Umar Abbas Sep 12 '19 at 08:01