Accessing the index of the current focused screen

G

Guest

I was wondering how to access by index of the screen in which the application
is one when there is more than one screen attached to the workstation or
notebook to get the bounds of the screen to resize the form to make most use
of the screen resolution. I know how using the Screen class to reference by
index the screen by AllScreens but want to know how to get the correct index
of the current screen when it is not the primary screen.
 
K

Kevin Spencer

When there is more than one screen being used, the form or any Control may
be partially on one screen and partially on another. You can use the
Screen.FromControl static method to get a reference to the Screen instance
that has the largest portion of the Control, or the Screen.FrontPoint static
method to get a reference to the Screen having a given point, such as mouse
location, or the Screen.GetBounds static method to get the Bounds rectangle
of any screen having the majority of a Control, Point, or Rectangle in it.

Here's the online Windows.Forms.Screen reference:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.screen.aspx

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
G

Guest

Unfortunately it does not answer my question! The form that I have designed
will be only contained within the one screen. I had already checked out the
reference but it neither answered my question. Could you please let me know
if there are any additional avenues to try to resolve the problem.
--
yours sincerely

Craig Hoy


Kevin Spencer said:
When there is more than one screen being used, the form or any Control may
be partially on one screen and partially on another. You can use the
Screen.FromControl static method to get a reference to the Screen instance
that has the largest portion of the Control, or the Screen.FrontPoint static
method to get a reference to the Screen having a given point, such as mouse
location, or the Screen.GetBounds static method to get the Bounds rectangle
of any screen having the majority of a Control, Point, or Rectangle in it.

Here's the online Windows.Forms.Screen reference:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.screen.aspx

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
K

Kevin Spencer

What exactly IS the problem?

The fact that a form will only be contained in one screen is not relevant,
other than to understand how the Screen class works, and why it works the
way it does. The documentation I sent you to is the full documentation for
the Screen class. So, the answer to your problem is there. But at this
point, I'm not sure what your problem *is*.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

SMEC NET Programmer said:
Unfortunately it does not answer my question! The form that I have
designed
will be only contained within the one screen. I had already checked out
the
reference but it neither answered my question. Could you please let me
know
if there are any additional avenues to try to resolve the problem.
 

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