WPF 应用程序在远程访问会话期间移出屏幕
我有一个问题,我希望找到最好和最容易实施的解决方案。
我编写了一个 WPF 应用程序,可以在桌面上拖动,但我通常将其放在屏幕的右上角。
我的问题是,当我从另一个位置远程拨入时(分辨率始终较低),应用程序位于屏幕外,除非我终止进程并重新启动它,否则我无法将其取回。
我想到了一些想法,以使其始终保持可见。
1]每当它运行时,它都会生成一个子线程,用于循环检查可见分辨率。当它超出检测到的范围时,它将更新其位置。
2]当我远程登录时,使用某种消息系统向它发送消息 - 这将触发它重新调整自身。
有人有什么建议吗?
i have a problem in which i am hoping to find the best and easiest to implement solution.
I have written a WPF application which can be dragged around the desktop but i usually put it in the top right hand corner of the screen.
My problem is that when i remote dial in from another location - where the resolution is always lower - the application is offscreen and there is no way for me to get it back unless i kill the process and relaunch it.
I have thought of some ideas in order to always keep it visible.
1] Whenever it is running have it spawn a child thread that checks the visible resolution in a loop. When it is outside the detected bounds it will update its location.
2] Use some sort of messaging system to send it a message when i remote in - and that will trigger it to re-align itself.
Does anyone have any suggestions??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以有一个定期(每隔几秒)触发的 DispatcherTimer 以确保窗口位于可见屏幕之一上。如果不是,它会重新定位,使其保持原来的位置。
即使您使用的是 WPF,您也可以使用 System.Windows.Forms.Screen 类来访问有关用户桌面和屏幕设置的信息。
像这样的东西:
You could have a DispatcherTimer that fires periodically (every few seconds) to ensure that the window is on one of the visible screens. If not, it would reposition so that it is.
You can use the System.Windows.Forms.Screen class to access information about the user's desktop and screen setup, even though you're using WPF.
Something like: