I am working with an application that will have sub forms. The primary form opens above the system tray, and on mouse-over, secondary windows will open right next to the primary. When I use the Me.location = New Point ()
and then assign the point, it works great… until I change PC's and the user has a different screen resolution.
I was thinking of something like this:
Dim intX As Integer = Screen.PrimaryScreen.Bounds.Width
Dim intY As Integer = Screen.PrimaryScreen.Bounds.Height
Dim errMsg As String = "An Error has occured. Please close the app and contact Jeremy." + Environment.NewLine + "Error 101: Missing Resolution " + Str(intX) + " x " + Str(intY) + "."
MsgBox(errMsg, vbCritical)
Select Case intX
Case "1920"
If intY = "1200" Then
'Me.Location = New Point
Else
MsgBox(errMsg, vbCritical)
End If
Case "1650"
If intY = "1200" Then
'Me.Location = New Point
MsgBox(errMsg, vbCritical)
Else
MsgBox(errMsg, vbCritical)
End If
Case "1440"
If intY = "900" Then
'Me.Location = New Point
Else
MsgBox(errMsg, vbCritical)
End If
Case "1280"
Select Case intY
Case "1024"
'Me.Location = New Point
Case "960"
'Me.Location = New Point
Case "800"
'Me.Location = New Point
Case "768"
'Me.Location = New Point
Case Else
MsgBox(errMsg, vbCritical)
End Select
End Select
But I am confident there is a cleaner, faster way to determine the screen resolution and decide placement of the secondary windows.