How to find where is the seconde screen in on a dual monitor system

  • Thread starter Thread starter Rolf Welskes
  • Start date Start date
R

Rolf Welskes

Hello,
I have a dot net application which must use dual screen of windows xp.
I use .net 1.1 (and it must be 1.1).

Now I can recognize for example from a point that I am not on the
PrimeryScreen. Ok.

But to make coordinate calculation I must know where is the second screen
on the left on the right, below or above.

I see no method or property in the Screen Class to determine this.

Thank you for any help.

Rolf Welskes
 
Hi Rolf,

If you open the display control panel applet and adjust the second
monitor's position by using arrow keys, you will notice it's moving
rounding the primary monitor. Depends on how to define "left" or "right",
you need to calculate that accordingly.

One thing to note is that the primary screen always originates from (0,0),
if the second screen is at the left side of the primary, the X coordinate
will be negative. You could easily simulate the display applet's screen
position by using the Screen object's Bounds property.

Let me know if you need further information regarding this. Thanks.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hello,
thank you for the answer.
With the control panel is clear for me.
But this is not the problem.
The software product can run on one computer, where the seconde screen is on
the left,
on another computer, where it is on the bottom, etc.

So I must have clear informatiions where it is.

The methode to take the coordinates I have tested.
BUT:
Think at the following:
A user has a primary screen with 1000x1000 pixel.
A secondary screen with 2000x2000 pixel

If i have now the coordindates (1500, 1500) and I know I am on the second
screen.
But where is it on the right or on the bottom?
On the right is possible because of x=1500 because I am outside of the
primary screen.
Also that y = 1500 is not a problem because I have 2000x2000
So the monitor is on the right.

OR:
It can also be on the bottom:
Because:
y = 1500 I am on the bottom because y= 1500 means I am outside the primary
screen.
x = 1500 is possible, because the monitor has 2000x2000 pixels.

So I have (1500,1500) as coordinate, know I am on the second monitor,
but I am not able to see where on the right or on the bottom.

Is it possible to see clear, on which monitor I am?


Thank you for any help.
Rolf Welskes
 
Hi Rolf,

First we need to know what is called "Virtual Screen": The bounding
rectangle of all the monitors is the virtual screen. The desktop covers the
virtual screen instead of a single monitor. See following for more info,
there's a picture illustrates a possible arrangement of three monitors.

#The Virtual Screen
http://windowssdk.msdn.microsoft.com/en-us/library/ms534613.aspx
The primary monitor contains the origin (0,0). This is for compatibility
with existing applications that expect a monitor with an origin. However,
the primary monitor does not have to be in the upper left of the virtual
screen.


When you use WinForm's Location to read the coordinate of the left-top
point of your window, it sometimes can be negative (relative to the primary
monitor's position).

From your example of 1000x1000, 2000x2000 monitors and location
(1500,1500), I understand your concern: you will know that the location is
not on the primary monitor (using Screen.FromControl(this) to get the
screen, then check the Screen.Primary property).

To know if the second screen is on right or bottom of the primary one, you
need to check the Screen.Bounds property, if it's on right side, the Left
property will be 1000; if it's on the bottom side, the Left property will
be 0.

Actually it's not difficult to simulate the display control panel applet to
draw the rectangles represents the screens positions, you just need to know
they're on the same virtual screen, and you can know their positions using
their Bounds property.

Let me know if you need further information.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hello,
thank you for your informations.
This informations of you have solved the problem within minutes.
Thank you again.
Rolf Welskes
 
Back
Top