我的工作站有 3 个显示器。我的应用程序中有 2 个窗口:大窗口和小窗口。BIG Window 正在主屏幕上运行。并且 LITTLE Window 应该显示在另一个特定的屏幕上,无论这个屏幕的数量是多少。
我现在不知道这个屏幕的编号是多少(1,2,3..),我不知道屏幕在哪里(在左侧,在主屏幕的右侧)。
我有什么办法可以做到这一点?是否有一些唯一的 ID 属于屏幕?
谢谢你们
它可以使用屏幕类来完成。 https://msdn.microsoft.com/en-us/library/system.windows.forms.screen.aspx
标识每个屏幕的示例代码:
// For each screen, add the screen properties to a list box.
foreach (var screen in System.Windows.Forms.Screen.AllScreens)
{
listBox1.Items.Add("Device Name: " + screen.DeviceName);
listBox1.Items.Add("Bounds: " +
screen.Bounds.ToString());
listBox1.Items.Add("Type: " +
screen.GetType().ToString());
listBox1.Items.Add("Working Area: " +
screen.WorkingArea.ToString());
listBox1.Items.Add("Primary Screen: " +
screen.Primary.ToString());
}