一个应用程序的两个不同接口和监视器

时间:2017-09-23 08:31:04

标签: c# user-interface monitor

我希望为软件提供两个不同的用户界面,以便通过执行软件,One显示在第一台显示器上,另一台显示在第二台显示器上。这可能吗?我可以区分软件中的两个显示器吗? (该程序是用C#和Visual Studio编写的。)

谢谢...

1 个答案:

答案 0 :(得分:1)

您可以尝试以下代码示例:

Form2 form2 = new Form2(); 

// Set this variable to the desired monitor.
int indexMonitor = 1;

// Get all the available monitors/ screens
Screen[] sc = Screen.AllScreens; 

// Use the Bounds.Width and Bounds.Height of the monitor to display form2 on the second monitor.
form2.Left = sc[indexMonitor].Bounds.Width; 
form2.Top = sc[indexMonitor].Bounds.Height; 

// You modified the .Left and .Top of form2, so you will need to use the FormStartPosition.Manual
form2.StartPosition = FormStartPosition.Manual; 
form2.Show(); 

有关Screen clas的更多信息:Click

相关问题