G
Guest
Is there a way to make one's application *ONLY* work in portrait mode without
to much effort?
to much effort?
Whaqt do you mean? Have the app not load if the device is landscape or
something like that? You could always check the screen dimensions at
startup (Screen.PrimaryScreen.Width & Height) and toss up a message at that
point.
Noble Bell said:That is what I mean. This is what I have come up with.
I place the following code in the form's Got_Focus event:
Dim screenHeight As Integer = Me.Bottom + Me.Top
Dim screenWidth As Integer = Me.Left + Me.Right
Dim txt As String = ""
Dim x As Integer
If screenHeight = 240 & screenWidth = 320 Then
' landscape mode
txt = "This program is designed to " + vbCrLf
txt = txt + "work in portrait mode only." + vbCrLf + vbCrLf
txt = txt + "Please reset to portrait mode and try again."
x = MessageBox.Show(txt, "Orientation Error!",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button1)
Application.Exit()
ElseIf screenHeight = 320 & screenWidth = 240 Then
' portrait mode
End If
It appears to be working so far.