I have a dual monitor set up, and for the prgrams i create it would be really handy to add a function that moves the form to the other monitor, when a button is clicked for example.
How could this b done??
Thanks
GTJ
Printable View
I have a dual monitor set up, and for the prgrams i create it would be really handy to add a function that moves the form to the other monitor, when a button is clicked for example.
How could this b done??
Thanks
GTJ
By making it appear at a higher Left value than the top of the first resolution.
For example.
If you had 2 monitors at 1024x768, set the form to appear at Left value of 1025. Thus putting it on the other monitor.
ahhh i c
cheers!!
GTJ
Glad it works for you :)
You can use the Screen class to get information about your monitors. The following code will put a form in the top, left corner of the second monitor if there is more than one, or else the top, left corner of the first monitor if there is only one:Code:Screen[] screens = Screen.AllScreens;
Screen targetScreen = null;
if (screens.Length == 1)
{
// There is only one monitor.
targetScreen = Screen.PrimaryScreen;
}
else
{
// There are multiple monitors.
foreach (Screen scr in screens)
{
if (!scr.Primary)
{
// This is not the primary monitor.
targetScreen = scr;
break;
}
}
}
this.Location = targetScreen.Bounds.Location;
wow thats cool,
cheers