SoFunction
Updated on 2025-03-06

2 ways to realize multi-display display in Winform window

A host is connected to 2 monitors (2 graphics cards), requiring two forms of a program to be displayed on different monitors: Display 1 displays From1, Display 2 displays From2. The code and description are as follows:


Form1 does not need to change the code, From2 adds the following code:

// Method 1:
From2 frm2 = new From2();
if (() != 1)
{
   = [0].;
   = 0;
   = new ([1]., [1].);
}
// Method 2:    = (([1]. - ) / 2);
    = (([1]. - ) / 2);
    = new ([1]., [1].);


illustrate:
Get the number of screens connected to the current system: ();
Get the name of the current screen: string CurrentScreenName = (this).DeviceName;
Get the current screen object: Screen CurrentScreen = (this);
Get the screen where the current mouse is located: Screen CurrentScreen = (new Point(, ));