Paul
Wed Jul 13 11:00:50 CDT 2005
To check the number of displays configured use:
_iScreenCount = Screen.AllScreens.Length
This function will return the bounding rectangle for a screen:-
Public Function GetDisplayRect (Display As Integer) As Rectangle
'Get the display rectangle for the specified screen.
'** Note: function numbers displays from 1, although system numbers
from 0
Dim ScreenNo As Integer
Dim ScreenRect As Rectangle = Nothing
If (Display > 0 And Display <= _iScreenCount) Then
ScreenNo = Display - 1
ScreenRect = Screen.AllScreens(ScreenNo).Bounds
End If
Return (ScreenRect)
End Function
To save the position of a form just do it as normal, and it will be
positioned back on the same screen.
The above function is very useful if you need to force a form onto a
particular screen.
Paul
Özden Irmak wrote:
> Hello Carlos,
>
> Thanks for the quick and valuable reply...
>
> I have one more question :
>
> To identify a screen, I think I need to use the Screen.DeviceName right? I'm
> asking this as I'll somehow have to identify and store a value to identify a
> screen...
>
> Thanks in advance...
>
> Regards,
>
> Özden Irmak
>
> "Carlos J. Quintero [.NET MVP]" <carlosq@NOSPAMsogecable.com> wrote in
> message news:Oi3d4sacFHA.1456@TK2MSFTNGP15.phx.gbl...
>
>>Take a look at the System.Windows.Forms.Screen class and methods.
>>
>>The Screen.FromControl(form) returns the Screen of your form.
>>
>>To set the position, you can try Form.SetDesktopLocation(x,y).
>>
>>--
>>
>>Best regards,
>>
>>Carlos J. Quintero
>>
>>MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
>>You can code, design and document much faster.
>>Free resources for add-in developers:
>>
http://www.mztools.com
>>
>>"Özden Irmak" <ozdenirmak(at)isnet.net.tr> escribió en el mensaje
>>news:eIv5qkacFHA.2340@tk2msftngp13.phx.gbl...
>>
>>>Hello,
>>>
>>>My appliccation saves form size and positions whenever they are closed so
>>>they can be shown at the same size and position when opened next time.
>>>
>>>My problem in here is that when it is used in Multiple screen
>>>enviornment, I can't understand whether the window is in which screen and
>>>I also don't know how to set the position of a window other than the
>>>primary screen?
>>>
>>>Can anybody help me?
>>>
>>>Regards,
>>>
>>>Özden Irmak
>>>
>>
>>
>
>