confused about return of 'Screen.Bounds' in WPF and Winform

184 views Asked by At

I have two monitor(1:3840X2160 200% scale, 2:1280X1024 100% scale)

how they look like

Then I write something to get my screen resoluton.

        System.Drawing.Rectangle entireSize = System.Drawing.Rectangle.Empty;
        foreach (System.Windows.Forms.Screen screen in System.Windows.Forms.Screen.AllScreens)
            Console.WriteLine(screen.Bounds.Width + "," + screen.Bounds.Height);

Here comes the confuse.

TEST1: In Winfrom, I got output

1280,1024 1920,1080

TEST2: while in WPF, it shows

2560,2048 3840,2160

TSET3: check dpi Winform: 96 WPF: 192

Here is my questions:

  1. Why dose Winform\Wpf return different resolution/DPI?
  2. Obviously '2560,2048' from wpf is not correct, but why wpf return '1280X1024 * 200%'?
  3. How can i get a same output from both winform and wpf?
0

There are 0 answers