Search code examples
c#winformsfullscreen

Full screen c# windows form covering all monitor


Is there a way to make make a windows form application full screen and black out your secondary monitors? So the main display is on your primary display and all your other monitors are just completely black?


Solution

  • You can use the Screen class which give you informations about the current active screens.

    // Form myFrm
    Rectangle r = new Rectangle();
    foreach (Screen s in Screen.AllScreens)
    {
       if ( s != Screen.CurrentScreen ) // Blackout only the secondary screens
             r = Rectangle.Union(r, s.Bounds);
    }
    myFrm.Top = r.Top;
    myFrm.Left = r.Left;
    myFrm.Width = r.Width;
    myFrm.Height = r.Height;
    myFrm.TopMost = true; // This will bring your window in front of all other windows including the taskbar