Reputation: 1
I have two form and two screens in a .Net application.
When I run the program, I want to specify where the forms are located: the main form must run on first screen and second form must run on second screen.
How can I specify the screen location for forms?
Upvotes: 0
Views: 61
Reputation: 1325
All you need to setup form.Location = new Point(X,Y);
All screens are located on the same coordinate grid with 0,0 point on the top left corner of the primary screen.
You can use System.Windows.Forms.Screen.AllScreens
to get positions and sizes (in Bounds
property of a screen) to decide where to put your form. Note that screen on the left or above the main screen has negative coordinates of top-left corner.
Upvotes: 4