Hi,
Check this :
http://www.devx.com/wireless/Article/21590
The approach is to create 2 forms (one vertical 246x318 and one horizontal
326x246) and then copy the InitializeComponent() to two methods
a.. Private Sub LandscapeMode()
a.. Private Sub PortraitMode()
and then switch between the 2 orientations in the Resize event of the form :
Private Sub Form1_Resize(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Resize
If (Screen.PrimaryScreen.Bounds.Width > _
Screen.PrimaryScreen.Bounds.Height) Then
' switch to landscape mode
LandscapeMode()
Else
' switch to portrait mode
PortraitMode()
End If
End Sub
The incovenience is that it is not independant of the resolution... Maybe
something between the 2 approaches : one form vertical, one horizontal and
then scale for the resolution?
Hope this helps,
Gérard.
"Saurabh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> Can anyone please tell me any other way(s) to change the screen
orientation.
> Currently, What I did is:
>
> 1) Develop the UI based on a particular screen orientation ( portrait -
> 240X320).
> 2) In the resize event of every page, I found the ratio of height for the
> current clientrectangle height to 320 and similar ratio for width.
> i.e heightratio = this.clientrectangle.height/288 ( and not 320 because
320
> is overall width and 288 is the client rectangle width that is there in my
> app.)
> widthratio = this.clientrectangle.width /240
>
> 3) I multiplied the bounds of each control with the height and width ratio
> as in :
> label1.bounds = new size((int)Math.Round(WidthRatio * x),
> (int)Math.Round(HeightRatio * y))
>
> With this, the orientation is changing but there is a lot of overlap
between
> the controls because of approximate results. Also, this approach is
generic
> i.e. independent of any resolution and orientation. Is there any better
way
> out?
>
> Secondly, When we resize any form, then all the forms which are cached
also
> get resized. This causes a lot of overhead. Can we stop that.
>
> Please help
>
> Saurabh
>
>