Maximize form on both screens (dual screen monitor)

前端 未结 6 1161
春和景丽
春和景丽 2021-01-01 07:01

Iam looking for some hint or solution regarding following problem.

I have a .NET 2.0 WinForm dialog which operates in Dual Screen environment. The Working area is se

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-01 07:29

    I know this thread is very old - but I found a very useful and working solution from here after trying and having problems with every solution listed here.

    What worked for me was

    Rectangle r = new Rectangle();
            foreach (Screen s in Screen.AllScreens)
            {
                if (s != Screen.FromControl(this)) // Blackout only the secondary screens
                    r = Rectangle.Union(r, s.Bounds);
            }
    
            this.Top = r.Top;
            this.Left = r.Left;
            this.Width = r.Width;
            this.Height = r.Height;
    

提交回复
热议问题