|
-
Apr 23rd, 2006, 04:36 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Move form to other monitor?
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
-
Apr 23rd, 2006, 04:49 PM
#2
Re: Move form to other monitor?
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.
-
Apr 23rd, 2006, 05:14 PM
#3
Thread Starter
Hyperactive Member
Re: Move form to other monitor?
-
Apr 23rd, 2006, 05:15 PM
#4
Re: [RESOLVED] Move form to other monitor?
Glad it works for you
-
Apr 23rd, 2006, 06:23 PM
#5
Re: [RESOLVED] Move form to other monitor?
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;
-
Apr 24th, 2006, 05:02 AM
#6
Thread Starter
Hyperactive Member
Re: [RESOLVED] Move form to other monitor?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|