将应用程序扩展到双显示器

时间:2011-07-27 13:25:11

标签: c# visual-studio-2010 monitors

我有一个在单个监视器上运行的应用程序。它有网格。例如,如果应用程序可以容纳3个网格并且有4个项目要放置,则第4个项目应该转到第二个屏幕。 Algo:检查网格大小       如果网格大小超过3            在第二个(双)屏幕中打开剩余部分。

请让我知道如何解决这个问题。

2 个答案:

答案 0 :(得分:3)

http://msdn.microsoft.com/de-de/library/system.windows.forms.screen.allscreens.aspx

void showOnMonitor(int showOnMonitor) 
{ 
  Screen[] sc; 
  sc = Screen.AllScreens; 
  //get all the screen width and heights 
  Form2 f = new Form2(); 
  f.FormBorderStyle = FormBorderStyle.None; 
  f.Left = sc[showOnMonitor].Bounds.Width; 
  f.Top = sc[showOnMonitor].Bounds.Height; 
  f.StartPosition = FormStartPosition.Manual; 
  f.Show(); 
}

答案 1 :(得分:0)

检查类型System.Windows.Forms.Screen。