> Assuming a user has a dual (or more) monitor setup, how do I force a
windows form application to open up and display in the default monitor
of the system?
Here's how to centre the form on the primary monitor:
***
Rectangle wa = Screen.PrimaryScreen.WorkingArea;
this.Location = new Point(
((wa.Width - this.Width) / 2) + wa.X,
((wa.Height - this.Width) / 2) + wa.Y);
***
It centres the window on the working area of the screen (i.e. not including the area taken up by the start bar etc.) If
you would prefer to make it based on the full screen area then set wa to Screen.PrimaryScreen.Bounds instead.
Hope this helps,
Mike
- Microsoft Visual Basic MVP -
E-Mail:
ED***@mvps.org
WWW:
Http://EDais.mvps.org/