如何手动设置Windows窗体位置 [英] How Can I Set The Windows Form Position Manually
问题描述
我正在开发桌面应用程序,它加载一个带有不同文本和条件的表单就是这样当我点击确定按钮它从表单中逐个显示文本
它工作正常但问题是我有多个屏幕,并说当我在当前屏幕上加载表单并单击确定它保持在主屏幕,这是好的,但说当我加载我的表单并将其拖动到下一个屏幕并单击确定它再次回到主屏幕屏幕但我希望它留在另一个屏幕上......我把它拖到
这里是加载我的表格的代码行
if(Form1.ShowDialog(this )== DialogResult.OK)
//在这一行每次我点击确定它会显示表格但在主屏幕中所以有任何解决方案我可以控制位置我的意思是新位置我在grag它进入...
I am developing Desktop application, which loads a Form with different Texts and condition is so When i Click ok Button it shows Texts from the Form one by one
it is working perfectly but the Problem is i have more than one screen and say when i load a form on Current screen and click OK it stays at primary screen which is Ok ,but say when i load my form and drag it to next screen and click ok its comes back again to Primary Screen But i want it to stay on another Screen ...where i drag it into
here is line of code which loads my form
if (Form1.ShowDialog(this) == DialogResult.OK)
// at this line every time i click ok it shows the form but in Primary Screen so is there any solutions i can control the position i mean new position where i grag it into...
推荐答案
在 http://stackoverflow.com/questions/2561104/how-do-i-ensure-a-form-displays -on-the--monitor-in-a-dual-monitor-sc [ ^ ]
所以基本上你需要存储哪个监视器/表单关闭时的位置,并根据该数据,在下次打开表单时手动设置位置。
Showing the form in a secondary monitor is very nicley explained in http://stackoverflow.com/questions/2561104/how-do-i-ensure-a-form-displays-on-the-additional-monitor-in-a-dual-monitor-sc[^]
So basically you need to store on which monitor/where the form was when it was closed and based on that data yo manually set the location when the form is opened the next time.
>
这篇关于如何手动设置Windows窗体位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!