Working with multiple displays

  • Thread starter Thread starter Steve Marshall
  • Start date Start date
S

Steve Marshall

I'm looking at developing an application which would benefit from being
able to work with 2 display monitors. But how do I work with multiple
displays? I'd like to be able to control which display a form opens
on, etc. Are there objects/APIs in .NET that support this? I've
trolled through the object browser, but haven't been able to find
anything. Either they aren't there, or I'm not looking for the right
words. Any advice welcomed.
 
Hi Steve,

The System.Windows.Forms.Screen class has info about the available screens,
dimensions, etc.

So, if the computer is set to use extended desktop you will have 2 screens
and you can change the Location property of a form to position it beyond the
x-boundary (1024 typically) of the primary screen.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
 
Carlos said:
Hi Steve,

The System.Windows.Forms.Screen class has info about the available screens,
dimensions, etc.

So, if the computer is set to use extended desktop you will have 2 screens
and you can change the Location property of a form to position it beyond the
x-boundary (1024 typically) of the primary screen.

As Carlos wrote, you use the Screen class to obtain info about the
available screens. eg -

Dim Scrn() as Screen = Screen.AllScreens
Dim ScrnCount As UInt16 = UBound(Scrn)

As I have 4 screens on my system, "ScrnCount" will return a value of 3.

A couple of traps to watch out for are -

1. Don't assume all screen resolutions to be the same. Some people have
multiple screens using multiple resolutions. Obtain specific screen
details using properties such as "Scrn(x).WorkingArea" etc.

2. The identity number of screens isn't always as you might think. For
example, my 4 screens are horizontally positioned from left to right on
my desk. No matter how many times I have changed the identity settings
to 0-1-2-3, for some reason XP eventually defaults back to 0-3-1-2 in
its identity sequence! (Windows Settings actually displays this as
1-4-2-3) So, if I try to position my Form by writing - "Me.Left =
Scrn(1).WorkingArea.X" the Form will display on the left-hand edge of
the 3rd screen along. Which is a nuisance if I'm trying to carry-over a
display that was shown on the 1st screen. I know of others who have
this same problem!

I hope this provides a bit more insight for you.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
 
Back
Top