3
votes

I am trying to resize a window that covers entire screen.

I tried out following

        win.Left = SystemParameters.VirtualScreenLeft;
        win.Top = SystemParameters.VirtualScreenTop;
        win.Width = SystemParameters.VirtualScreenWidth;
        win.Height = SystemParameters.VirtualScreenHeight;

This works perfectly on a monitor of 1080p (Full HD monitor). It also works when I have two monitors attached and one of which is full HD where as the other is an HD monitor. I understand that in such case some of the part of the window will never become visible as it will go out of the bounds of total screen asset.

The problem starts with 4k monitor. On a 4k monitor, it consumes a smaller rectangle on screen and does not span to cover the entire screen. I understand that this is due to scaling (wpf automatically scales window) but not able to find a way to overcome this issue.

The issue is just with the 4k monitor. I assume that it has something to do with DPI as the 4k monitor has higher DPI.

My question is, how to make the application use entire screen asset irrespective of monitor resolution and DPI.

(Please note that setting window maximized will not work as it will not span it over multiple monitors.)

1

1 Answers

0
votes

It turned out that the issue was not with resizing of window at all. Window was properly resizing after specifying the co-ordinates. However, there is one thing which might help those who want to do similar thing. Always make sure that you compare the values retrieved form API with the other values from API and WPF with WPF as WPF yields scaled values.