开发者

c# - easy way to get maximum window x/y bounds?

开发者 https://www.devze.com 2023-01-20 15:24 出处:网络
I have a custom styled transparent window and i\'ve seen a lot of issues handling min/max/resize behavior when you use transparency and \"WindowStyle=None\".

I have a custom styled transparent window and i've seen a lot of issues handling min/max/resize behavior when you use transparency and "WindowStyle=None".

When I tell my window to change it's windowstate to maximized it doesn't get it right so I want to override the logic there. It gets the width right but the height is all messed up and it doesn't know to add padding to account for a outerglow effect.

Without using win32 functions is there a SOMEWHAT EASY way for me to determine the "max viewport" or "max bounds" of the display that the application is running on top of? I think the short answer to this question is probably no but I figured I would ask anyways. I have my min/max width and he开发者_如何学Goight set up for the application and I figured if there was some function I could call to bring me back a x/y max bound then I could just set the window height and width to those values after I subtract the padding. My intention is to have supported resolution from 1024x768 - 1920x1080 so that this application can be displayed multiple places without reconfiguration.


Take a look at the Screen.PrimaryScreen Property. It has a method called GetWorkingArea which I think is what you want.

If there is more than one display, then there are methods to enumerate through the displays and find out which display the application is on.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号