Hi,

I'm building an application that should always run in landscape mode
using compact framework 2. I came up with this:
private void Form1_Resize(object sender, EventArgs e)
{
if (SystemSettings.ScreenOrientation != ScreenOrientation.Angle270);
SystemSettings.ScreenOrientation = ScreenOrientation.Angle270;
}

but that throws an exception, so I put it in an GotFocus event, which
seems out to work just fine, on the emulator. However, that event is
never fired on my PDA.

Anyone has a clue why setting ScreenOrientation results in an exception
when it is assigned a value during OnResize or why GotFocus isn't
called on my PDA? Or is there any other way to lock the value of
ScreenOrientation?

Thanks for any input...
Nico

Re: Lock into Landscape mode by nicowyow

nicowyow
Sat Nov 04 08:32:51 CST 2006

Ok, the GotFocus is ran, but only on startup and when a messagebox is
closed.

I also want to add that my application runs full screen.


Re: Lock into Landscape mode by Fabien

Fabien
Mon Nov 06 01:58:07 CST 2006

Hi,

Did you try the OnLoad Method of your form?

BR


Fabien Decret
Windows Embedded Consultant

ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/




nicowyow@gmail.com a =E9crit :

> Ok, the GotFocus is ran, but only on startup and when a messagebox is
> closed.
>=20
> I also want to add that my application runs full screen.


Re: Lock into Landscape mode by nicowyow

nicowyow
Mon Nov 06 07:13:34 CST 2006

I want to block people from adjusting the screenmode while running the
application, setting it to landscape in the firstplace is no problem.
So OnLoad would be useless..

I want to Lock into landscape mode, so i need some event to fire if
someone wants to change my to portrait or I need to lock the variable
in some way...

Fabien wrote:
> Hi,
>
> Did you try the OnLoad Method of your form?
>
> BR
>
>
> Fabien Decret
> Windows Embedded Consultant
>
> ADENEO (ADESET)
> http://www.adeneo.adetelgroup.com/
>
>
>
>
> nicowyow@gmail.com a =E9crit :
>
> > Ok, the GotFocus is ran, but only on startup and when a messagebox is
> > closed.
> >=20
> > I also want to add that my application runs full screen.


Re: Lock into Landscape mode by Peter

Peter
Tue Nov 07 02:24:23 CST 2006

I'm pretty sure you can't lock the mode, but you can catch when the
orientation is changed (Resize event of form) and change it immediately back
as required (.NETCF v2.0 has
Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation)

Peter

--
Peter Foot
Device Application Development MVP
www.peterfoot.net | www.inthehand.com

<nicowyow@gmail.com> wrote in message
news:1162818814.726768.100570@i42g2000cwa.googlegroups.com...
I want to block people from adjusting the screenmode while running the
application, setting it to landscape in the firstplace is no problem.
So OnLoad would be useless..

I want to Lock into landscape mode, so i need some event to fire if
someone wants to change my to portrait or I need to lock the variable
in some way...

Fabien wrote:
> Hi,
>
> Did you try the OnLoad Method of your form?
>
> BR
>
>
> Fabien Decret
> Windows Embedded Consultant
>
> ADENEO (ADESET)
> http://www.adeneo.adetelgroup.com/
>
>
>
>
> nicowyow@gmail.com a écrit :
>
> > Ok, the GotFocus is ran, but only on startup and when a messagebox is
> > closed.
> >
> > I also want to add that my application runs full screen.


Re: Lock into Landscape mode by nicowyow

nicowyow
Tue Nov 07 03:22:33 CST 2006

Thanks for the input, but like I said, that throws an exception on my
PDA, so I'm sure it will throw in on more devices...

I created a workaround :
onfocus it flips the screen to landscape if it isn't already
onresize i show a message dialog with "application only supports
landscape mode". Then after the user closes the dialog, the onfocus is
called and the application returns to landscape mode.

I don't like "solutions" like this, any descent solution would be nice.

> I'm pretty sure you can't lock the mode, but you can catch when the
> orientation is changed (Resize event of form) and change it immediately b=
ack
> as required (.NETCF v2.0 has
> Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation)
>
> Peter
>
> --
> Peter Foot
> Device Application Development MVP
> www.peterfoot.net | www.inthehand.com
>
> <nicowyow@gmail.com> wrote in message
> news:1162818814.726768.100570@i42g2000cwa.googlegroups.com...
> I want to block people from adjusting the screenmode while running the
> application, setting it to landscape in the firstplace is no problem.
> So OnLoad would be useless..
>
> I want to Lock into landscape mode, so i need some event to fire if
> someone wants to change my to portrait or I need to lock the variable
> in some way...
>
> Fabien wrote:
> > Hi,
> >
> > Did you try the OnLoad Method of your form?
> >
> > BR
> >
> >
> > Fabien Decret
> > Windows Embedded Consultant
> >
> > ADENEO (ADESET)
> > http://www.adeneo.adetelgroup.com/
> >
> >
> >
> >
> > nicowyow@gmail.com a =E9crit :
> >
> > > Ok, the GotFocus is ran, but only on startup and when a messagebox is
> > > closed.
> > >
> > > I also want to add that my application runs full screen.


Re: Lock into Landscape mode by ctacke/>

ctacke/>
Tue Nov 07 06:38:46 CST 2006

The problem is that you are trying to override hardware behavior from your
application - something the device was not designed to support. This is why
you're supposed to make your UI dynamic.You're attempting to do something
that will affect all apps on the system, and that's generally not a good
practice, so there are no hooks provided to do it. Anything that might do
it will be a hack, and the only real way I can think of to do it well is to
write a new display driver so you can override the rotate requests.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--




<nicowyow@gmail.com> wrote in message
news:1162891353.258845.211310@m7g2000cwm.googlegroups.com...
Thanks for the input, but like I said, that throws an exception on my
PDA, so I'm sure it will throw in on more devices...

I created a workaround :
onfocus it flips the screen to landscape if it isn't already
onresize i show a message dialog with "application only supports
landscape mode". Then after the user closes the dialog, the onfocus is
called and the application returns to landscape mode.

I don't like "solutions" like this, any descent solution would be nice.

> I'm pretty sure you can't lock the mode, but you can catch when the
> orientation is changed (Resize event of form) and change it immediately
> back
> as required (.NETCF v2.0 has
> Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation)
>
> Peter
>
> --
> Peter Foot
> Device Application Development MVP
> www.peterfoot.net | www.inthehand.com
>
> <nicowyow@gmail.com> wrote in message
> news:1162818814.726768.100570@i42g2000cwa.googlegroups.com...
> I want to block people from adjusting the screenmode while running the
> application, setting it to landscape in the firstplace is no problem.
> So OnLoad would be useless..
>
> I want to Lock into landscape mode, so i need some event to fire if
> someone wants to change my to portrait or I need to lock the variable
> in some way...
>
> Fabien wrote:
> > Hi,
> >
> > Did you try the OnLoad Method of your form?
> >
> > BR
> >
> >
> > Fabien Decret
> > Windows Embedded Consultant
> >
> > ADENEO (ADESET)
> > http://www.adeneo.adetelgroup.com/
> >
> >
> >
> >
> > nicowyow@gmail.com a écrit :
> >
> > > Ok, the GotFocus is ran, but only on startup and when a messagebox is
> > > closed.
> > >
> > > I also want to add that my application runs full screen.



Re: Lock into Landscape mode by keeper

keeper
Fri Nov 10 06:08:28 CST 2006

The other thing I'd be careful of is some devices have slide-out
keyboards.
If the keyboard slides out portrait then the user wouldn't be able to
use it with the app.
If the keyboard slides out landscape then there is the chance it may
slide out the opposite side to the orientation of your app.

Plus, what if the device doesn't support landscape (ie, a square
screen).
Working with a fixed layout like this may just cause you headaches in
the future when someone turns around and demands support for a
different pda.

<ctacke/> wrote:

> The problem is that you are trying to override hardware behavior from your
> application - something the device was not designed to support. This is =
why
> you're supposed to make your UI dynamic.You're attempting to do something
> that will affect all apps on the system, and that's generally not a good
> practice, so there are no hooks provided to do it. Anything that might do
> it will be a hack, and the only real way I can think of to do it well is =
to
> write a new display driver so you can override the rotate requests.
>
>
> --
> Chris Tacke
> OpenNETCF Consulting
> Managed Code in the Embedded World
> www.opennetcf.com
> --
>
>
>
>
> <nicowyow@gmail.com> wrote in message
> news:1162891353.258845.211310@m7g2000cwm.googlegroups.com...
> Thanks for the input, but like I said, that throws an exception on my
> PDA, so I'm sure it will throw in on more devices...
>
> I created a workaround :
> onfocus it flips the screen to landscape if it isn't already
> onresize i show a message dialog with "application only supports
> landscape mode". Then after the user closes the dialog, the onfocus is
> called and the application returns to landscape mode.
>
> I don't like "solutions" like this, any descent solution would be nice.
>
> > I'm pretty sure you can't lock the mode, but you can catch when the
> > orientation is changed (Resize event of form) and change it immediately
> > back
> > as required (.NETCF v2.0 has
> > Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation)
> >
> > Peter
> >
> > --
> > Peter Foot
> > Device Application Development MVP
> > www.peterfoot.net | www.inthehand.com
> >
> > <nicowyow@gmail.com> wrote in message
> > news:1162818814.726768.100570@i42g2000cwa.googlegroups.com...
> > I want to block people from adjusting the screenmode while running the
> > application, setting it to landscape in the firstplace is no problem.
> > So OnLoad would be useless..
> >
> > I want to Lock into landscape mode, so i need some event to fire if
> > someone wants to change my to portrait or I need to lock the variable
> > in some way...
> >
> > Fabien wrote:
> > > Hi,
> > >
> > > Did you try the OnLoad Method of your form?
> > >
> > > BR
> > >
> > >
> > > Fabien Decret
> > > Windows Embedded Consultant
> > >
> > > ADENEO (ADESET)
> > > http://www.adeneo.adetelgroup.com/
> > >
> > >
> > >
> > >
> > > nicowyow@gmail.com a =E9crit :
> > >
> > > > Ok, the GotFocus is ran, but only on startup and when a messagebox =
is
> > > > closed.
> > > >
> > > > I also want to add that my application runs full screen.