2017-04-26 18 views
0

我接管了在.Net版本4上运行的Winforms应用程序的维护。启动对象是登录窗体。我有三台显示器。登录表单以我的鼠标指针所在的任何监视器为中心打开。我找不到表单中设置位置的任何代码。我从来没有见过这样的表格。有没有一种设置可以使这种情况发生,或者这只是正常的行为?Winforms应用程序中的多个监视器和启动对象的位置

回答

1

检查窗体的StartPosition - 好像设置为​​。
从MSDNs页FormStartPosition枚举:

Member name    Description 
CenterParent   The form is centered within the bounds of its parent form. 
CenterScreen   The form is centered on the current display, and has the dimensions specified in the form's size. 
Manual     The position of the form is determined by the Location property. 
WindowsDefaultBounds The form is positioned at the Windows default location and has the bounds determined by Windows default. 
WindowsDefaultLocation The form is positioned at the Windows default location and has the dimensions specified in the form's size. 

注意CenterScreen描述你描述的到底是什么。

+0

谢谢。我把这个标记为答案,因为它确实回答了我的问题,但我发现它并非总是如此。 StartPosition设置为CenterScreen的其他形式并非如此。这些表单将始终在主窗口中打开。我发现不同的是窗体的ShowInTaskbar属性。设置为True,表单在当前显示中打开,如文档所述。设置为False并且表单总是在主显示屏中打开。我会编辑你的答案以添加这条信息,但我似乎还没有足够的权限。 –

相关问题