应用程序的监视器/屏幕更改事件?

发布于 2024-10-28 00:08:15 字数 204 浏览 11 评论 0原文

我的 WPF 应用程序中有一个 DataGrid。我正在设置 DataGrid 相对于应用程序当前所在屏幕分辨率的最大宽度。

当用户在主监视器上启动应用程序时,我的解决方案工作正常,但当用户将应用程序拖动到第二个监视器时就会出现问题监视器。我需要一个事件来告诉我应用程序何时移动到新监视器,以便我可以根据当前监视器的分辨率重置 DataGrid 的最大宽度。我怎样才能做到这一点?

I have a DataGrid in my WPF application. I am setting DataGrid's maximum width relative to resolution of screen in which application currently resides in.

My solution works fine when user launches the application on primary monitor but the problem comes when user drags the application to second monitor. I need an event which can tell me when the application is moved to a new monitor so that I can reset the DataGrid's maximum width according to current monitor's resolution. How can I do that?

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

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

发布评论

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

评论(1

‖放下 2024-11-04 00:08:15

您是否尝试过 LocationChanged 事件?

Did you try the LocationChanged event?

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