473,903 Members | 5,025 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Public Class Form
Inherits System.Windows. Forms.For

#Region " Windows Form Designer generated code

Public Sub New(

'This call is required by the Windows Form Designer
InitializeCompo nent(

'Add any initialization after the InitializeCompo nent() 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.Disp ose(
End I
End I
MyBase.Dispose( disposing
End Su

'Required by the Windows Form Designe
Private components As System.Componen tModel.IContain e

'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.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent(
Me._TopPanel = New System.Windows. Forms.Pane
Me.Button1 = New System.Windows. Forms.Butto
Me.Label1 = New System.Windows. Forms.Labe
Me._TopPanel.Su spendLayout(
Me.SuspendLayou t(


Me._TopPanel.Ba ckColor = System.Drawing. Color.FromArgb( CType(192, Byte), CType(192, Byte), CType(255, Byte)
Me._TopPanel.Co ntrols.Add(Me.L abel1
Me._TopPanel.Co ntrols.Add(Me.B utton1
Me._TopPanel.Do ck = System.Windows. Forms.DockStyle .To
Me._TopPanel.Lo cation = New System.Drawing. Point(0, 0
Me._TopPanel.Na me = "_TopPanel
Me._TopPanel.Si ze = New System.Drawing. Size(644, 112
Me._TopPanel.Ta bIndex =


Me.Button1.Loca tion = New System.Drawing. Point(12, 12
Me.Button1.Name = "Button1
Me.Button1.TabI ndex =
Me.Button1.Text = "Button1


Me.Label1.Ancho r = CType(((System. Windows.Forms.A nchorStyles.Top Or System.Windows. Forms.AnchorSty les.Left)
Or System.Windows. Forms.AnchorSty les.Right), System.Windows. Forms.AnchorSty les
Me.Label1.Locat ion = New System.Drawing. Point(8, 40
Me.Label1.Name = "Label1
Me.Label1.Size = New System.Drawing. Size(628, 64
Me.Label1.TabIn dex =
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.


Me.AutoScaleBas eSize = 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.Re sumeLayout(Fals e
Me.ResumeLayout (False

End Su

#End Regio

Protected WithEvents _MyChild As New Windows.Forms.F or
Protected WithEvents _MyChildLabel As New Windows.Forms.L abe

Private Sub Form1_Load(ByVa l sender As Object, ByVal e As System.EventArg s) Handles MyBase.Load
Me.IsMdiContain er = True

Me._MyChildLabe l.Dock = DockStyle.Fill
Me._MyChildLabe l.BackColor = Drawing.Color.P ink

Me._MyChild.Sta rtPosition = FormStartPositi on.Manual
Me._MyChild.Con trols.Add(Me._M yChildLabel)

Me._MyChild.Mdi Parent = Me

Me._MyChild.Sho w()
End Sub

Private Sub Button1_Click(B yVal sender As Object, ByVal e As System.EventArg s) Handles Button1.Click
If (Me._MyChild.Md iParent Is Me) Then
Me._MyChild.Vis ible = False
Me._MyChild.Mdi Parent = Nothing
Me._MyChild.Mdi Parent = Me
Me._MyChild.Vis ible = True
End If
End Sub

Private Sub _MyChildLabel_M ouseEnter(ByVal sender As Object, ByVal e As System.EventArg s) Handles _MyChildLabel.M ouseEnter
Static cnt As Integer : cnt += 1
Debug.WriteLine (System.String. Format("{0}: MyChildLabel.Mo useEnter", cnt.ToString))
End Sub

Private Sub _MyChildLabel_M ouseLeave(ByVal sender As Object, ByVal e As System.EventArg s) Handles _MyChildLabel.M ouseLeave
Static cnt As Integer : cnt += 1
Debug.WriteLine (System.String. Format("{0}: MyChildLabel.Mo useLeave", cnt.ToString))
End Sub

End Class

Nov 20 '05 #1
3 3226
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
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.

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

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"
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

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 buttons, which is fine most of the time (he comes from a Mac environment, so I accept mouse clicks from the right or left button when he's working on the PC). But every once in a while, he'll press and hold the right mouse button, move onto a JButton,...
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 events respond continuously whenever the mouse is moving inside the DIV area. Does anybody have a clue about what is happenning ? J2G
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 userControl, I can detect the movement using MouseMove event. the problem is when the mouse is on the child control : I can t detect
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 processing on certain key/mouse events 3) If key/mouse events interrupt processing, the events should not be discarded since they need to be handled but AFTER the current processing is complete
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 tried various mouse move/leave event handling scenario's involving the form or the controls on it's client area but no
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 when menu items are clicked.Besides these i would like to put a custom status bar. Any error message encountered in any of the webpage will be displayed in the banner. The problem iam encountering is how to access the customer status bar in child...
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 well. He is frequently missing the left mouse button and hitting the right, or less often the middle (wheel) buttons. While he is very slowly getting better with practice, the frustration level is high for him as a result of this (he gets very...
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 forecolor, backcolor and font. The labels also are rotatable and the text can also be flipped 180 degrees (the flipped text part is still being worked on). I have one context menu for all 30 labels that allows for the property changes to the labels....
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 areas). This means that if the mouse is currently inside the form's client area and it enters a child, a MouseLeave event will be generated on the form. One little trick to overcome this is to do a point-in-rectangle test inside the MouseLeave...
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.