G
Guest
I've noticed that controls that are contained in MDI child forms fail to raise MouseLeave events if the MDI child form's MdiParent property is set to Nothing (after it was set to an existing MDI container form) or if the MDI child form's Visible property is set to False (after the MDI child form was shown). This is an enormous problem for my app because I must show different MDI child forms based on the state of my application and many of the controls in the MDI child forms are highly interactive (i.e., the controls require mouse events)
1. Is there a work around for this bug
2. Is this bug fixed in the most recent "technology preview" of VS 2005? If so, how can I obtain a DVD of that version? (I don't have a DVD burner so downloading the iso file is useless)
Please note that disposing and recreating instances of the MDI child forms when my app changes states is not a practical solution. Also, I've included some sample code that demonstrates this issue
Thanks for any help
Lanc
Public Class Form
Inherits System.Windows.Forms.For
#Region " Windows Form Designer generated code
Public Sub New(
MyBase.New(
'This call is required by the Windows Form Designer
InitializeComponent(
'Add any initialization after the InitializeComponent() cal
End Su
'Form overrides dispose to clean up the component list
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean
If disposing The
If Not (components Is Nothing) The
components.Dispose(
End I
End I
MyBase.Dispose(disposing
End Su
'Required by the Windows Form Designe
Private components As System.ComponentModel.IContaine
'NOTE: The following procedure is required by the Windows Form Designe
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor
Friend WithEvents _TopPanel As System.Windows.Forms.Pane
Friend WithEvents Button1 As System.Windows.Forms.Butto
Friend WithEvents Label1 As System.Windows.Forms.Labe
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent(
Me._TopPanel = New System.Windows.Forms.Pane
Me.Button1 = New System.Windows.Forms.Butto
Me.Label1 = New System.Windows.Forms.Labe
Me._TopPanel.SuspendLayout(
Me.SuspendLayout(
'_TopPane
Me._TopPanel.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)
Me._TopPanel.Controls.Add(Me.Label1
Me._TopPanel.Controls.Add(Me.Button1
Me._TopPanel.Dock = System.Windows.Forms.DockStyle.To
Me._TopPanel.Location = New System.Drawing.Point(0, 0
Me._TopPanel.Name = "_TopPanel
Me._TopPanel.Size = New System.Drawing.Size(644, 112
Me._TopPanel.TabIndex =
'Button
Me.Button1.Location = New System.Drawing.Point(12, 12
Me.Button1.Name = "Button1
Me.Button1.TabIndex =
Me.Button1.Text = "Button1
'Label
Me.Label1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left)
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles
Me.Label1.Location = New System.Drawing.Point(8, 40
Me.Label1.Name = "Label1
Me.Label1.Size = New System.Drawing.Size(628, 64
Me.Label1.TabIndex =
Me.Label1.Text = "Move the mouse in and out of the client area of the MDI child form and notice tha" &
"t the MDI child's label raises MouseLeave and MouseEnter events. Then, click Bu" &
"tton1 twice then repeate the previous steps, noticing that now the MDI child's l" &
"abel does not raise MouseLeave and MouseEnter events.
'Form
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15
Me.ClientSize = New System.Drawing.Size(644, 662
Me.Controls.Add(Me._TopPanel
Me.Name = "Form1
Me.Text = "Form1
Me._TopPanel.ResumeLayout(False
Me.ResumeLayout(False
End Su
#End Regio
Protected WithEvents _MyChild As New Windows.Forms.For
Protected WithEvents _MyChildLabel As New Windows.Forms.Labe
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.IsMdiContainer = True
Me._MyChildLabel.Dock = DockStyle.Fill
Me._MyChildLabel.BackColor = Drawing.Color.Pink
Me._MyChild.StartPosition = FormStartPosition.Manual
Me._MyChild.Controls.Add(Me._MyChildLabel)
Me._MyChild.MdiParent = Me
Me._MyChild.Show()
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If (Me._MyChild.MdiParent Is Me) Then
Me._MyChild.Visible = False
Me._MyChild.MdiParent = Nothing
Else
Me._MyChild.MdiParent = Me
Me._MyChild.Visible = True
End If
End Sub
Private Sub _MyChildLabel_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles _MyChildLabel.MouseEnter
Static cnt As Integer : cnt += 1
Debug.WriteLine(System.String.Format("{0}: MyChildLabel.MouseEnter", cnt.ToString))
End Sub
Private Sub _MyChildLabel_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles _MyChildLabel.MouseLeave
Static cnt As Integer : cnt += 1
Debug.WriteLine(System.String.Format("{0}: MyChildLabel.MouseLeave", cnt.ToString))
End Sub
End Class
1. Is there a work around for this bug
2. Is this bug fixed in the most recent "technology preview" of VS 2005? If so, how can I obtain a DVD of that version? (I don't have a DVD burner so downloading the iso file is useless)
Please note that disposing and recreating instances of the MDI child forms when my app changes states is not a practical solution. Also, I've included some sample code that demonstrates this issue
Thanks for any help
Lanc
Public Class Form
Inherits System.Windows.Forms.For
#Region " Windows Form Designer generated code
Public Sub New(
MyBase.New(
'This call is required by the Windows Form Designer
InitializeComponent(
'Add any initialization after the InitializeComponent() cal
End Su
'Form overrides dispose to clean up the component list
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean
If disposing The
If Not (components Is Nothing) The
components.Dispose(
End I
End I
MyBase.Dispose(disposing
End Su
'Required by the Windows Form Designe
Private components As System.ComponentModel.IContaine
'NOTE: The following procedure is required by the Windows Form Designe
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor
Friend WithEvents _TopPanel As System.Windows.Forms.Pane
Friend WithEvents Button1 As System.Windows.Forms.Butto
Friend WithEvents Label1 As System.Windows.Forms.Labe
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent(
Me._TopPanel = New System.Windows.Forms.Pane
Me.Button1 = New System.Windows.Forms.Butto
Me.Label1 = New System.Windows.Forms.Labe
Me._TopPanel.SuspendLayout(
Me.SuspendLayout(
'_TopPane
Me._TopPanel.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)
Me._TopPanel.Controls.Add(Me.Label1
Me._TopPanel.Controls.Add(Me.Button1
Me._TopPanel.Dock = System.Windows.Forms.DockStyle.To
Me._TopPanel.Location = New System.Drawing.Point(0, 0
Me._TopPanel.Name = "_TopPanel
Me._TopPanel.Size = New System.Drawing.Size(644, 112
Me._TopPanel.TabIndex =
'Button
Me.Button1.Location = New System.Drawing.Point(12, 12
Me.Button1.Name = "Button1
Me.Button1.TabIndex =
Me.Button1.Text = "Button1
'Label
Me.Label1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left)
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles
Me.Label1.Location = New System.Drawing.Point(8, 40
Me.Label1.Name = "Label1
Me.Label1.Size = New System.Drawing.Size(628, 64
Me.Label1.TabIndex =
Me.Label1.Text = "Move the mouse in and out of the client area of the MDI child form and notice tha" &
"t the MDI child's label raises MouseLeave and MouseEnter events. Then, click Bu" &
"tton1 twice then repeate the previous steps, noticing that now the MDI child's l" &
"abel does not raise MouseLeave and MouseEnter events.
'Form
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15
Me.ClientSize = New System.Drawing.Size(644, 662
Me.Controls.Add(Me._TopPanel
Me.Name = "Form1
Me.Text = "Form1
Me._TopPanel.ResumeLayout(False
Me.ResumeLayout(False
End Su
#End Regio
Protected WithEvents _MyChild As New Windows.Forms.For
Protected WithEvents _MyChildLabel As New Windows.Forms.Labe
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.IsMdiContainer = True
Me._MyChildLabel.Dock = DockStyle.Fill
Me._MyChildLabel.BackColor = Drawing.Color.Pink
Me._MyChild.StartPosition = FormStartPosition.Manual
Me._MyChild.Controls.Add(Me._MyChildLabel)
Me._MyChild.MdiParent = Me
Me._MyChild.Show()
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If (Me._MyChild.MdiParent Is Me) Then
Me._MyChild.Visible = False
Me._MyChild.MdiParent = Nothing
Else
Me._MyChild.MdiParent = Me
Me._MyChild.Visible = True
End If
End Sub
Private Sub _MyChildLabel_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles _MyChildLabel.MouseEnter
Static cnt As Integer : cnt += 1
Debug.WriteLine(System.String.Format("{0}: MyChildLabel.MouseEnter", cnt.ToString))
End Sub
Private Sub _MyChildLabel_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles _MyChildLabel.MouseLeave
Static cnt As Integer : cnt += 1
Debug.WriteLine(System.String.Format("{0}: MyChildLabel.MouseLeave", cnt.ToString))
End Sub
End Class