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

Re: Multiple Screen environment... by Carlos

Carlos
Wed Jun 15 08:07:42 CDT 2005

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
>



Re: Multiple Screen environment... by Özden

Özden
Wed Jun 15 08:30:48 CDT 2005

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
>>
>
>



Re: Multiple Screen environment... by Carlos

Carlos
Wed Jun 15 08:49:20 CDT 2005

Yes, but you can also identify a screen but its Bounds or WorkingArea
properties.
--

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:OsQD05acFHA.2420@TK2MSFTNGP15.phx.gbl...
> 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



Re: Multiple Screen environment... by Peter

Peter
Wed Jun 15 14:44:26 CDT 2005

On Wed, 15 Jun 2005 15:52:58 +0300, "Özden Irmak"
<ozdenirmak(at)isnet.net.tr> wrote:

>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
>
I've got a dual monitor system, primary monitor on the right, and I
just save the left, top, width and height of a form. The left-hand
monitor has negative "left" values, but I don't really need to know
that if I'm just saving and restoring form positions.


Re: Multiple Screen environment... by Paul

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
>>>
>>
>>
>
>