确定应用程序正在运行的屏幕并在屏幕中打开一个对话框 [英] Determining which screen a application is running and open a dialog box in the screen
本文介绍了确定应用程序正在运行的屏幕并在屏幕中打开一个对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我有一个自定义对话框,当用户调用它时会打开(按钮点击)。这在单个屏幕上工作正常。我遇到的问题是,当父应用程序在辅助屏幕上时,对话框在主屏幕中打开。
有谁能告诉我如何才能使对话框在与父对象相同的屏幕中打开?
Hi there,
I have a custom made Dialog box that opens when the user calls it (button click). This works fine on a single screen. The problem I have is that when the parent application is on the secondary screen, the dialog box open in the primary screen.
Can anyone tell me how can I make the dialog box open in the same screen as the parent?
推荐答案
您可以使用 Screen.FromControl [ ^ ]找到窗口在哪个屏幕上(或至少大部分)然后根据屏幕位置设置窗口的位置。
You can use Screen.FromControl[^] to find on which screen the window is (or at least the most of it) and then set the location of your window based on that screens location.
这篇关于确定应用程序正在运行的屏幕并在屏幕中打开一个对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文