1
votes

I have a WPF application and want to output the bounds and working areas of the monitors I have. The code is as follows:

foreach (var screen in Screen.AllScreens.ToList().OrderByDescending(s => s.Primary)) // Primary Screen comes first
{
    Console.WriteLine("Device:       " + screen.DeviceName);
    Console.WriteLine("Bounds      : " + screen.Bounds);
    Console.WriteLine("Working Area: " + screen.WorkingArea);
}

DISPLAY1 is my primary screen, and DISPLAY2 is my secondary. Both have the same resolution: 1920 x 1080.

The weird thing is that this code gives the following output:

Device: \.\DISPLAY1 Bounds : {X=0,Y=0,Width=1920,Height=1080} Working Area: {X=0,Y=0,Width=1920,Height=1046}

Device: \.\DISPLAY2 Bounds : {X=2400,Y=0,Width=2400,Height=1350} Working Area: {X=2400,Y=0,Width=2400,Height=1308}

I have also changed the use of Screen.AllScreens with the Monitor class provided at: http://wpftutorial.net/ScreenResolutions.html but this still returns the same values. Any one ever encountered this issue?

Thanks

Joseph

1

1 Answers

1
votes

It looks like you have a different DPI set on both screens.