Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you force a .net application to display on a particular monitor in a dual monitor setup?

I would like to run multiple copies of my application and force the first to open on one monitor and the second instance on a second monitor

like image 245
Darrel Miller Avatar asked Oct 03 '08 00:10

Darrel Miller


1 Answers

Screen monitor1 = System.Windows.Forms.Screen.AllScreens[0];
Screen monitor2 = System.Windows.Forms.Screen.AllScreens[1];

will give you the size and position information for both monitors.

Form f = new Form();
f.Location = monitor2.Location;
f.Size = monitor2.Size;
f.StartPosition = FormStartPosition.Manual;
f.WindowState = FormWindowState.Maximized;
f.Show();

should pop a form up in your second monitor.

like image 193
MusiGenesis Avatar answered Sep 20 '22 06:09

MusiGenesis