Carlos J. Quintero [VB MVP] wrote:
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.