473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Mouse events & MDI child forms

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

Nov 20 '05 #1
3 3184
Hi Lance,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you when you hide an child form
and re-show the child form, the Mouse Leave Event will not be fired any
more.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I have found similar issue in our database, this is an known issue. So far
we do not have an workaround for the issue. And the issue will be fixed in
the next release version of whidbey. But I think the preview version of VS
2005 did not fix the problem.

As for the DVD of the preview version, I think you can download the ISO
file and use a virtual CD/DVD-ROM emulator software to load the iso as an
driver, so that you can read it. e.g. the Daemon tools, you can download it
at the link below.
http://www.daemon-tools.cc/dtcc/portal/download.php

Thank you for your understanding.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #2
Thank you very much for the info. Not what I wanted to hear, but very useful nonetheless
And the issue will be fixed in the next release version of whidbey


Can you please tell me if you are referring to the next alpha or beta version that (I've heard) is scheduled for release some time in May, or the final version that won't be out until ~Q1 2005

Thanks again
Lanc

Nov 20 '05 #3
Hi Lance,

Thank you for your reply.

I think I can not confirm when the VS.NET 2005(Whidbey), I'd suggest you
pay attention to our website.

Visual Studio "Whidbey"
http://msdn.microsoft.com/vstudio/whidbey/default.aspx
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John Champaign | last post by:
Hi all, I'm working on an educational applet for a child with special needs. He's got a bit of a trick to make my life more difficult... To interact with the applet he needs to click on...
1
by: Jean-Gael GRICOURT | last post by:
I am trying to capture mouse events when entering and leaving a DIV layer. This test code works fine with IE 6.0 and Opera 7.21 but fails with Mozilla/Netscape. The strange thing is that the mouse...
3
by: red | last post by:
mouse events when the mouse is on a "child control" hi everyone; my problem: I have a userControl in this usercontrol, I have a child control (a button) when the mouse moves over the...
5
by: Bill Henning | last post by:
Does anyone know a good method of preventing keyboard and mouse events from interrupting processing? My situation is: 1) I need to track and handle all key and mouse events 2) I need to perform...
3
by: AinO | last post by:
Hi, (VS2003/c# - System.Windows.Forms) Is there a way to know (have an event triggered) if the mouse leaves a form, if this form's client area is completly covered with child controls ? I...
12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
13
by: James Bond | last post by:
Hello. My 80+ year old father has recently decided to get his first computer. Due to his age (and I suspect lack of playing pong as a child like I did) he lacks the manual dexterity to use a mouse...
3
by: jcrouse | last post by:
I have created a form designer type application (with a lot of you peoples helpJ). It has label controls that are draggable at runtime. The user is also allowed to change some properties such as...
4
by: cb.brite | last post by:
Hello, I have tried this using the MouseEnter/MouseLeave events. However these events do not really refer to the rectangular shape of the form, but the client area (form area minus children...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.