Winforms应用程序中的多个监视器和启动对象的位置

Winforms应用程序中的多个监视器和启动对象的位置,winforms,Winforms,我已经接管了运行在.Net版本4上的Winforms应用程序的维护工作。启动对象是登录表单。我有三台显示器。登录表单以鼠标指针所在的监视器为中心打开。我在表单中找不到任何设置其位置的代码。我以前从未见过这样的表单。是否存在导致这种情况发生的设置,或者这只是正常行为?检查表单的-似乎它是在FormStartPosition.CenterScreen上设置的 从MSDNs枚举页面: 请注意,CenterScreen准确描述了您所描述的内容。谢谢。我将此标记为答案,因为它确实回答了我的问题,但我发现它

我已经接管了运行在.Net版本4上的Winforms应用程序的维护工作。启动对象是登录表单。我有三台显示器。登录表单以鼠标指针所在的监视器为中心打开。我在表单中找不到任何设置其位置的代码。我以前从未见过这样的表单。是否存在导致这种情况发生的设置,或者这只是正常行为?

检查表单的-似乎它是在
FormStartPosition.CenterScreen上设置的

从MSDNs枚举页面:


请注意,
CenterScreen
准确描述了您所描述的内容。

谢谢。我将此标记为答案,因为它确实回答了我的问题,但我发现它并不总是正确的。还有其他将StartPosition设置为CenterScreen的表单的行为不是这样的。这些表单将始终在主窗口中打开。我发现不同之处在于表单的ShowInTaskbar属性。如文档所述,设置为True,表单将在当前显示中打开。设置为False,则窗体始终在主显示中打开。我会编辑你的答案来添加这条信息,但我似乎还没有足够的特权。
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.