c# - 获得最大窗口 x/y 边界的简单方法?

发布于 2024-09-28 15:19:47 字数 398 浏览 2 评论 0原文

我有一个自定义样式的透明窗口,当您使用透明度和“WindowStyle=None”时,我看到很多处理最小/最大/调整大小行为的问题。

当我告诉我的窗口将其窗口状态更改为最大化时,它没有得到正确的结果,因此我想覆盖那里的逻辑。它的宽度是正确的,但高度却一团糟,而且它不知道添加填充来解决外发光效果。

在不使用 win32 函数的情况下,是否有一种简单的方法可以让我确定应用程序在其上运行的显示器的“最大视口”或“最大边界”?我认为这个问题的简短答案可能是否定的,但我想无论如何我都会问。我为应用程序设置了最小/最大宽度和高度,我想如果有一些函数我可以调用来带回 ax/y 最大边界,那么我可以在减去后将窗口高度和宽度设置为这些值填充物。我的目的是支持 1024x768 - 1920x1080 的分辨率,以便该应用程序可以在多个位置显示而无需重新配置。

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 height 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北音执念 2024-10-05 15:19:47

查看 Screen.PrimaryScreen 属性。它有一个名为 GetWorkingArea 的方法我想这就是你想要的。

如果有多个显示器,则有一些方法可以枚举显示器并找出应用程序位于哪个显示器上。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文