PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Portrait only?
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Portrait only?
![]() |
Portrait only? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Is there a way to make one's application *ONLY* work in portrait mode without
to much effort? ------------------------------------------ Noble D. Bell AgForest Partners, Inc. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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. -- Chris Tacke OpenNETCF Consulting Managed Code in the Embedded World www.opennetcf.com -- "Noble Bell" <NobleBell@discussions.microsoft.com> wrote in message news:EF841BAB-EED1-4ACE-AC81-B3183FD80E6B@microsoft.com... > Is there a way to make one's application *ONLY* work in portrait mode > without > to much effort? > > > ------------------------------------------ > Noble D. Bell > AgForest Partners, Inc. > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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. ------------------------------------------ Noble D. Bell AgForest Partners, Inc. "<ctacke/>" wrote: > 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. > > > -- > Chris Tacke > OpenNETCF Consulting > Managed Code in the Embedded World > www.opennetcf.com > -- > > > "Noble Bell" <NobleBell@discussions.microsoft.com> wrote in message > news:EF841BAB-EED1-4ACE-AC81-B3183FD80E6B@microsoft.com... > > Is there a way to make one's application *ONLY* work in portrait mode > > without > > to much effort? > > > > > > ------------------------------------------ > > Noble D. Bell > > AgForest Partners, Inc. > > > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
You can access the System.Windows.Forms.Screen.PrimaryScreen.Bounds rather
than working out the size from your form. Also rather than quitting and giving the user instructions to change the orientation you can change it yourself in code. If you are using .NETCF v2.0 use the Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation property, for v1.0 there is a matching class in the Mobile In The Hand Community Edition:- http://www.inthehand.com/WindowsMobile.aspx Peter -- Peter Foot Device Application Development MVP www.peterfoot.net | www.inthehand.com "Noble Bell" <NobleBell@discussions.microsoft.com> wrote in message news:CCD0DDE1-7DEC-4E5C-BFA7-AE539E5AB68E@microsoft.com... > 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. > > > ------------------------------------------ > Noble D. Bell > AgForest Partners, Inc. > > > > "<ctacke/>" wrote: > >> 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. >> >> >> -- >> Chris Tacke >> OpenNETCF Consulting >> Managed Code in the Embedded World >> www.opennetcf.com >> -- >> >> >> "Noble Bell" <NobleBell@discussions.microsoft.com> wrote in message >> news:EF841BAB-EED1-4ACE-AC81-B3183FD80E6B@microsoft.com... >> > Is there a way to make one's application *ONLY* work in portrait mode >> > without >> > to much effort? >> > >> > >> > ------------------------------------------ >> > Noble D. Bell >> > AgForest Partners, Inc. >> > >> >> >> |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

