A
Andrew K
Hi,
This is a problem I noticed in one of my applications the other day
and can't figure out how to fix.
In the attached code I have 2 forms. The form named form1 is the MDI
container, form2 is an MDIChild. I show the child form with the
following code in the Form_Load event of the MDI container...
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim f As New Form2
f.MdiParent = Me
f.Show()
End Sub
....on the child form I have placed 2 controls, a button and a
checkbox. I've set both the controls to FlatStyle.Flat so the
appearance changes on mouse events.
The following code is on the button click event...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Static bln As Boolean
If (bln) Then
Dim f As Form = Me.Owner
Me.Owner = Nothing
Me.MdiParent = f
bln = False
Else
Dim f As Form = Me.MdiParent
Me.MdiParent = Nothing
Me.Owner = f
bln = True
End If
End Sub
....this sets form2 to non-MDIChild and back to MDIChild.
The problem is when I do this with the code shown above the 2 controls
on the form stop responding to the mouse events enter and leave. This
can be seen quite easily because they no longer change appearance.
Is the code on the button click incorrect, or is this a known bug?
Any help would be much appreciated...
Regards
Andrew K
This is a problem I noticed in one of my applications the other day
and can't figure out how to fix.
In the attached code I have 2 forms. The form named form1 is the MDI
container, form2 is an MDIChild. I show the child form with the
following code in the Form_Load event of the MDI container...
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim f As New Form2
f.MdiParent = Me
f.Show()
End Sub
....on the child form I have placed 2 controls, a button and a
checkbox. I've set both the controls to FlatStyle.Flat so the
appearance changes on mouse events.
The following code is on the button click event...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Static bln As Boolean
If (bln) Then
Dim f As Form = Me.Owner
Me.Owner = Nothing
Me.MdiParent = f
bln = False
Else
Dim f As Form = Me.MdiParent
Me.MdiParent = Nothing
Me.Owner = f
bln = True
End If
End Sub
....this sets form2 to non-MDIChild and back to MDIChild.
The problem is when I do this with the code shown above the 2 controls
on the form stop responding to the mouse events enter and leave. This
can be seen quite easily because they no longer change appearance.
Is the code on the button click incorrect, or is this a known bug?
Any help would be much appreciated...
Regards
Andrew K