Multiple monitors

P

Peter Huish

My application runs on a system that has 2 monitors. Currently if I
display a dialog box it will display on the monitor that currently has
focus. Is there a mechanism to have the dialog display on the monitor
that the main form of the application displayed on?



thanks

pete
 
D

daveL

below is a excerpt from a static class i use , i believe u can use the
Screen class

Screen aScreens = Screeen.AllScreens // a collection of all monitors
configured on ur computer

// so you should be able to do what you need



hope this helps

Dave



public static void MoveForm(Control oControl, NetTools.dvAlignMent
ePosition)

{

Screen[] aScreens = Screen.AllScreens;

Rectangle R = aScreens[0].Bounds;

int xPos = 0;

int yPos = 0;

if (ePosition == dvAlignMent.BottomRight)

{

oControl.Location = new Point(R.Width - oControl.Size.Width, R.Height -
oControl.Size.Height);

}

else if (ePosition == dvAlignMent.BottomLeft)

{

oControl.Location = new Point(0, R.Height - oControl.Size.Height);

}

else if (ePosition == dvAlignMent.BottomCenter)

{

xPos = (R.Width / 2 - oControl.Width / 2);

oControl.Location = new Point(xPos, R.Height - oControl.Size.Height);

}

// top stuff

else if (ePosition == dvAlignMent.TopRight)

{

xPos = R.Width - oControl.Width; //R.Height;

yPos = 0;

oControl.Location = new Point(xPos, yPos);

}

else if (ePosition == dvAlignMent.TopLeft)

{

xPos = 0;

yPos = 0;

oControl.Location = new Point(xPos, yPos);

}
 

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

Top