Selecting which monitor a form is displayed on

  • Thread starter Thread starter wayne
  • Start date Start date
W

wayne

Does anyone know how to select the monitor that a form will be
displayed on at runtime? I would like to be able to display a list in
a form on the first monitor and a list of detailed reports in the
other. Does anyone know how to do this?

Thanks,
Wayne
 
Hi Wayne,

There is a Screen class that can help you with this. It has properties
like PrimaryScreen, AllScreens, WorkingSize and so on that you can use to
determine how many screens, which is the primary and their sizes etc.
 
Example (from another kind soul who helped me with a similar problem):

To open a form on the DEFAULT monitor which is also centered to the
screen:

<code>

private void Form1_Load(object sender, EventArgs e)
{
Rectangle wa = Screen.PrimaryScreen.WorkingArea;
Location = new Point(((wa.Width - Width)/2) + wa.X,
((wa.Height - Width)/2) + wa.Y);
}

</code>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top