Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys,
I need to develop an application that handles both exits of video of my PC. The idea is that on having initiated the application the principal form executes in the exit of principal video of the system and that send another form to the secondary video exit.

thanks!!
Posted

Hello,

you can do this by using the Screen class.

To make sure your principal form opens on the first screen:
C#
static void Main()
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    var form1 = new Form1();
    form1.StartPosition = FormStartPosition.Manual;
    form1.Location = Screen.PrimaryScreen.Bounds.Location;
    Application.Run(form1);
}


To open your second form on the secondary screen (or any other if more than 2):

C#
int screenToUse = 1;
Screen[] screens = Screen.AllScreens;
var form2 = new Form2();
form2.Location = screens[screenToUse].WorkingArea.Location;
form2.Show();


Valery.
 
Share this answer
 
Thanks, Valery! It helped me really.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900