Placing a Form on a particular Screen

P

Peter Oliphant

I'm programming using MS VS VC++ 2008 Express (Beta 2) in /Cli pure mode.

I've found the Screen class. With it I can very easily get the count and all
the data on the various Screens attached to a system, whether it be a single
screen or multiple screen system.

I believe the FromControl method of the Screen class can be used to
determine which Screen a Form is on. But I can't find how I can place or
move a Form onto the Screen of my choice (in code).

I looked in MSDN2.com. I can't find a Screen property in the Form class. I
can't find something like a Form's list or an AddForm method in Screen. So I
need help.

[==Peter==]
 
P

Peter Oliphant

I might be close to an answer here, but I could use some confirmation.

There is something called workingArea in the Screen class. I noticed in it
that my right-screen is listed as having a Left and Right value
corresponding to values as if it is an extension of my left-screen i.e., the
right-screen Left equals the left-screen's Right, and the left-screen's
Right is equal to the sum of the two screen's widths).

So, does this mean if a Form is on the right-screen and I give it NEGATIVE X
coordinates it will appear on the left-screen? Or that if a Form is on the
left-screen and I give large enough X coordinates it will start to appear on
the right-screen?

If this is true, that means a form can be logically on one screen and
visually on the other? That seems wrong somehow...

Am I totally off base here?

[==Peter==]
 
B

Ben Voigt [C++ MVP]

Peter Oliphant said:
I might be close to an answer here, but I could use some confirmation.

There is something called workingArea in the Screen class. I noticed in it
that my right-screen is listed as having a Left and Right value
corresponding to values as if it is an extension of my left-screen i.e.,
the right-screen Left equals the left-screen's Right, and the
left-screen's Right is equal to the sum of the two screen's widths).

So, does this mean if a Form is on the right-screen and I give it NEGATIVE
X coordinates it will appear on the left-screen? Or that if a Form is on
the left-screen and I give large enough X coordinates it will start to
appear on the right-screen?
Yes.


If this is true, that means a form can be logically on one screen and
visually on the other? That seems wrong somehow...

Am I totally off base here?

Well, sort of. There is no "logically on one screen". There is a single
coordinate system in which all screens are placed.

If the left screen starts at X=0, and the right screen starts at X=1024,
then if the Form is one the right screen it will have X >= 1024. To move to
the left screen (or spanning the gap) you'd set X < 1024, not negative X.

Hope this is what you needed to know.
[==Peter==]

Peter Oliphant said:
I'm programming using MS VS VC++ 2008 Express (Beta 2) in /Cli pure mode.

I've found the Screen class. With it I can very easily get the count and
all the data on the various Screens attached to a system, whether it be a
single screen or multiple screen system.

I believe the FromControl method of the Screen class can be used to
determine which Screen a Form is on. But I can't find how I can place or
move a Form onto the Screen of my choice (in code).

I looked in MSDN2.com. I can't find a Screen property in the Form class.
I can't find something like a Form's list or an AddForm method in Screen.
So I need help.

[==Peter==]
 
P

Peter Oliphant

Hey Ben,

Yup! Just wanted to be sure before I wrote a lot of code. Thanx again!!!
: )

[==Peter==]

Ben Voigt said:
Peter Oliphant said:
I might be close to an answer here, but I could use some confirmation.

There is something called workingArea in the Screen class. I noticed in
it that my right-screen is listed as having a Left and Right value
corresponding to values as if it is an extension of my left-screen i.e.,
the right-screen Left equals the left-screen's Right, and the
left-screen's Right is equal to the sum of the two screen's widths).

So, does this mean if a Form is on the right-screen and I give it
NEGATIVE X coordinates it will appear on the left-screen? Or that if a
Form is on the left-screen and I give large enough X coordinates it will
start to appear on the right-screen?
Yes.


If this is true, that means a form can be logically on one screen and
visually on the other? That seems wrong somehow...

Am I totally off base here?

Well, sort of. There is no "logically on one screen". There is a single
coordinate system in which all screens are placed.

If the left screen starts at X=0, and the right screen starts at X=1024,
then if the Form is one the right screen it will have X >= 1024. To move
to the left screen (or spanning the gap) you'd set X < 1024, not negative
X.

Hope this is what you needed to know.
[==Peter==]

Peter Oliphant said:
I'm programming using MS VS VC++ 2008 Express (Beta 2) in /Cli pure
mode.

I've found the Screen class. With it I can very easily get the count and
all the data on the various Screens attached to a system, whether it be
a single screen or multiple screen system.

I believe the FromControl method of the Screen class can be used to
determine which Screen a Form is on. But I can't find how I can place or
move a Form onto the Screen of my choice (in code).

I looked in MSDN2.com. I can't find a Screen property in the Form class.
I can't find something like a Form's list or an AddForm method in
Screen. So I need help.

[==Peter==]
 

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