'Move Form if second monitor screen exists
Looking for a way to load a from if a second screen exists.
I have tried this code with a load event:
Dim numofMon As Integer = Screen.AllScreens.Length
If numofMon > 1 Then
Me.Bounds = Screen.AllScreens(1).Bounds
End If
Side note: If someone could point me to how to detect when the cursor is no longer on the form, I would appreciate it.
Solution 1:[1]
This ended up working for me.
Dim obj as New Form2
obj.Location = Screen.AllScreens(UBound(Screen.Allscreens)).Bounds.Location
obj.show()
Solution 2:[2]
To be able to place the form on the second screen, set the WindowStartUpLocation to Manual before setting the Bounds. This causes the form to be positioned according to its Left and Top property values. These will then be set by changing the Bounds property as you already did.
To detect if the cursor is above the form that's currently focused, use the MouseEnter and MouseLeave events.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | InProgess |
| Solution 2 | Saragis |
