|
-
Jul 8th, 2010, 04:16 PM
#1
Thread Starter
Hyperactive Member
Running app in secondary monitor by default.
Hi, i have a dual monitor setup. i want my app to run in the secondary monitor by default (through settings in my app). i have been browsing the net for a solution and i found a solution which is setting the Form.Bounds to the Bounds of the secondary monitor. my problem is that if i set the bounds of my newly created form, when it gets displayed, it doesn't show in the secondary monitor.
Code:
private void button2_Click(object sender, EventArgs e)
{
Form1 frm = new Form1();
frm.SetBounds(-1280, 112, frm.Bounds.Width, frm.Bounds.Height);
MessageBox.Show(string.Format("frm.Bounds [{0},{1}]",frm.Bounds.Left,frm.Bounds.Top));
//frm.Bounds = Screen.AllScreens[1].Bounds;
//frm.Location = Screen.AllScreens[1].Bounds.Location;
frm.Show();
MessageBox.Show(string.Format("frm.Bounds [{0},{1}]", frm.Bounds.Left, frm.Bounds.Top));
}
in the code above, i first set the bounds, i can see from the message box the settings i assigned.
after form gets displayed, i checked the bounds again, it has changed to it's default
how do i show then a newly created form to a specific Bounds?
-
Jul 8th, 2010, 06:52 PM
#2
Re: Running app in secondary monitor by default.
Is there any chance whatsoever that the program will always be running on dual-screen system?
As for a quick and dirty solution, you could use My.Settings to hold a point value (the location of the form) and set it when the program closes. When the program starts up, if has been set (meaning it was ran at least once already) you can just position the form to those coord's. Which means if you close the program on your 2nd screen then next time you run it, it'll show on the 2nd screen.
-
Jul 8th, 2010, 07:58 PM
#3
Re: Running app in secondary monitor by default.
Have you set the form's StartPosition property to Manual?
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
|