B
Blarney
Hi all,
I am having a problem with the mybase.resize handler in my program. I
am using the "standard" screen rotation code to handle portrait and
landscape mode.
Private Sub frmMain_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Resize
If (Screen.PrimaryScreen.Bounds.Width >
Screen.PrimaryScreen.Bounds.Height) Then
Landscape()
Else
portrait()
End If
End Sub
Pretty simple huh? Anyway, I have been wrestling with this for several
days. I normally get a native exception error if I have the same
if/then statement in my form.load handler and the form.resize handler.
So I set a trap and found the following:
1. mybase.resize is being called 2 times while the program loads
2. If I minimize the app and bring it back to the front, mybase.resize
is called
What this results in is the portrait (or landscape) form builder to be
called repeatedly, painting the forms on each other. Which is
obviously slow - plus causes buttons not to work, etc.
Does anyone know what's causing this and how I can work around the
issue?
Thanks!
I am having a problem with the mybase.resize handler in my program. I
am using the "standard" screen rotation code to handle portrait and
landscape mode.
Private Sub frmMain_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Resize
If (Screen.PrimaryScreen.Bounds.Width >
Screen.PrimaryScreen.Bounds.Height) Then
Landscape()
Else
portrait()
End If
End Sub
Pretty simple huh? Anyway, I have been wrestling with this for several
days. I normally get a native exception error if I have the same
if/then statement in my form.load handler and the form.resize handler.
So I set a trap and found the following:
1. mybase.resize is being called 2 times while the program loads
2. If I minimize the app and bring it back to the front, mybase.resize
is called
What this results in is the portrait (or landscape) form builder to be
called repeatedly, painting the forms on each other. Which is
obviously slow - plus causes buttons not to work, etc.
Does anyone know what's causing this and how I can work around the
issue?
Thanks!