我想一个窗体同时在多个屏幕显示,并且每个屏幕显示的数据部一样,请问怎么实现?

解决方案 »

  1.   

    分屏
    public Rectangle[] GetSplittedRectangles(Rectangle rt, int rowCount,int colCount)
            {
                Rectangle[] rects = new Rectangle[rowCount * colCount];
                int width = rt.Width / colCount;
                int height = rt.Height / rowCount;
                for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
                {
                    for (int colIndex = 0; colIndex < colCount; colIndex++)
                    {
                  rects[rowIndex * colCount + colIndex] = new Rectangle(colIndex * width,
                     rowIndex * height, width, height);
                    }
                }
                return rects;
            }
    多显示器api
    EnumDisplayMonitors MonitorFromPoint 
      

  2.   

    我看.net有个自带的类叫Screen.AllScreens,可以获得所有的显示屏,我想应该可以做的吧
      

  3.   

        private void openForms()
        {
           Form2 form2 = new Form2();
           Form3 form3 = new Form3();
           Form4 form4 = new Form4();
         
           Screen[] screens = Screens.AllScreens;
           if(screens.Length == 2)
           {
              List<Screen> lstScreen = new List<Screen>();
              foreach(Screen screen in Screen.AllScreens)
              {
                 if(screen.Primary == false)
                    lstScree.Add(screen);
              }
              form2.Location = lstScreen[0].WorkingArea.Location;
              form3.Location = lstScreen[0].WorkingArea.Location;
              form4.Location = lstScreen[0].WorkingArea.Location;
           }
           else if(screens.Length == 4)
           {
              List<Screen> lstScreen = new List<Screen>();
              foreach(Screen screen in Screen.AllScreens)
              {
                 if(screen.Primary == false)
                    lstScree.Add(screen);
              }
              form2.Location = lstScreen[0].WorkingArea.Location;
              form3.Location = lstScreen[1].WorkingArea.Location;
              form4.Location = lstScreen[2].WorkingArea.Location;
           }
        }