草庐IT

CenterToScreen

全部标签

c# - 为什么 CenterToScreen 方法会在光标所在的屏幕而不是具有焦点的应用程序的屏幕上使表单居中?

我正在使用VisualStudio2010、C#.NET4、WinForms。我的电脑有2个显示器。当我调用窗体的CenterToScreen方法时,窗体会在光标所在的屏幕上居中。有谁知道为什么吗? 最佳答案 来自documentation:Donotcallthisdirectlyfromyourcode.Instead,settheStartPositionpropertytoCenterScreen.TheCenterToScreenmethodusesthefollowingprioritylisttodetermineth