473,397 Members | 1,950 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,397 software developers and data experts.

Mouse leave event help required!

59
Hi,

I have an owned form and a panel in a main window.
I want to run certain code on the mouse leave event of both of them. To be precise:

Expand|Select|Wrap|Line Numbers
  1. panel1.Visible=false;
on the mouse leave event of the panel
and
Expand|Select|Wrap|Line Numbers
  1. this.Hide();
on the mouse leave event of the owned form.
Both the form and the panel are completely full with a toolstrip (docked to the top) and a listView (docked to fill).
When I did not get the desired result I did put a breakpoint in the methods that run when the mouse leave event of the form and the panel is trigerred. I discovered that the control is not at all entering into the method.
This clearly means the mouse leave event is not at all getting triggered.
Am I missing some property?
Please guide.
Aug 28 '08 #1
2 1735
vekipeki
229 Expert 100+
Do you have your handlers attached somewhere in your Form.Designer.cs? You should have something like this:

Expand|Select|Wrap|Line Numbers
  1. this.MouseLeave += new System.EventHandler(Form_MouseLeave);
But if your panel and form are covered by a ListView, then you should attach your handlers to listView.MouseLeave event, because that's the one that will be fired.
Sep 1 '08 #2
babai28
59
Do you have your handlers attached somewhere in your Form.Designer.cs? You should have something like this:

Expand|Select|Wrap|Line Numbers
  1. this.MouseLeave += new System.EventHandler(Form_MouseLeave);
But if your panel and form are covered by a ListView, then you should attach your handlers to listView.MouseLeave event, because that's the one that will be fired.
Yeah, I discovered it. If the panel or the form are covered by other controls then the mouse leave event doesnt get fired for the container but the control that fills the container (panel or form). Actually apart from the list view i also have a toolstrip and a treeview in the panel/form and so if the mouse leaves the panel from the treeview side it wont get fired. Neverthless if the mouse leaves the list view and enters the treeview the panel will hide which is again not desired. One work around can be to pad the container (panel or the form) so that inspite of the controls filling them a little area remains exposed and the mouse leave event gets fired. However that may compromise the presentation of the window.
Thank you.
Sep 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Hunters | last post by:
I have split window consists of two panels. Left panel holds two controls with dock set to left and fill repectively. What i want to do is to resize the panel whenever mouse enter or leave the...
4
by: masantha wee | last post by:
Hi all, I am using Firefox and embedding Javascript in html. I understand that we can use mouse events by coding them in the body of html (by creating a button or anything and by adding in the...
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...
2
by: bretth | last post by:
In a VB.Net Windows Forms application, I have a user control that handles mouse events. Another section of code programmatically adds a label to the control. I would like label to ignore all...
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...
3
by: Spam Catcher | last post by:
Hi all, I'm having some trouble with the Mouse Hover/Leave events on a user control. Say I have a user control with a panel covering the whole control. In turn, a label + picture box cover...
5
by: kimiraikkonen | last post by:
Hi, I couldn't find a necessary class which shows when mouse hovers on a link in Webbrowser control. Think of there's a status bar(text), when mouse comes on a link, the URL must be shown in...
5
by: Zaxxon21 | last post by:
I'm basically trying to implement a simple drop down menu list for a button that I have. When the user hovers over the button, I want a list of button options to appear below the button. If the...
22
by: schneider | last post by:
I need to hook the system mouse down event. I'm trying to replicate how a context menu hides when the mouse clicks outside of the control. Thanks, Schneider
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
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,...
0
isladogs
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...

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.