【发布时间】:2011-06-23 12:01:23
【问题描述】:
我的 WPF 应用程序正在使用多个监视器。应用程序全屏运行,我希望能够在用户按下按钮时切换它所在的监视器。
case Key.M:
var allScreens = System.Windows.Forms.Screen.AllScreens.ToList();
if (this.CurrentScreen < allScreens.Count - 1)
{
this.CurrentScreen++;
}
else { this.CurrentScreen = 0; }
this.WindowStartupLocation = System.Windows.WindowStartupLocation.Manual;
this.Top = allScreens[this.CurrentScreen].Bounds.Top;
this.Left = allScreens[this.CurrentScreen].Bounds.Left;
break;
我正在尝试这样做,但是 this.Left 始终具有 (-7) 的值。我假设它不会让我设置它,因为我是全屏的,但我不是 100% 确定。如何让它全屏切换到另一台显示器?
【问题讨论】:
标签: wpf multiple-monitors