473,801 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MouseEnter Event

31 New Member
Hi,

I am creating a panel at run time.
Inside that panel i am creating 2 lables.

I had attached mouseenter and mouseleave events for label as well as panel.

Now I want to call the events of mouseenter of lable, when the mouse enters the panel.

How to i do that .......?
Oct 18 '10 #1
1 2851
Curtis Rutland
3,256 Recognized Expert Specialist
Just subscribe both to the same method. Alternatively, you could make one method that actually does the work that both call:

Example:
Expand|Select|Wrap|Line Numbers
  1. private void DoSomething(){
  2.   //do something
  3. }
  4.  
  5. private void label1_MouseEnter(object sender, EventArgs e){
  6.   DoSomething();
  7. }
  8.  
  9. private void panel1_MouseEnter(object sender, EventArgs e){
  10.   DoSomething();
  11. }
I'd suggest just creating one method with the proper signature, and subscribing both events to it.
Oct 18 '10 #2

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

Similar topics

0
1202
by: Tam | last post by:
Referring to MouseEnter event not being raised in a C# project im developing. Problem previously detailed by Louis MCutchen at http://www.tech-archive.net/Archive/VB/microsoft.public.vb.controls/2004-04/0158.html One reply says there is no 'sanctioned' workaround... Unlike Lois I cant live with this and need this to complete a project... Howabout an unsanctioned one?
0
895
by: Randy | last post by:
Hello, I've got a custom class... public class DataGridButtonColumn : DataGridTextBoxColumn which I use to put buttons in spreadsheet cells. The buttons are working fine. However, I'm trying to hook up a MouseEnter event so that I may change the cursor when the mouse enters the button control. I'm not having any luck with this. I've tried several (kind of) similar examples with no luck. Can
0
1935
by: Machi | last post by:
I am using C#.NET. API version showintaskbar form Window taskbar hide show not fire events MouseLeave and MouseEnter! Now i am facing a critical problem for MouseLeave and MouseEnter event when i activate window taskbar hide show. I do a testing that a form have 2 button and 1 label text. 1 button is showintaskbar=true, another is showintaskbar=false, label text is for MouseLeave and MouseEnter event to change color. I noted that the...
0
1083
by: Charles Law | last post by:
Is there a way to get the MouseEnter event to fire for a user control that inherits from UpDownBase? The event is hidden, and does not fire when the mouse enters the control. TIA Charles
5
1331
by: Simon Verona | last post by:
I have an inherited datagrid which has a "double-click" even which returns the row that has been clicked on - this can be consumed by the form (etc) that hosts the control to open another window that shows more detailed information on that line. I want to be able to change the mouse pointer when the user hovers over the control, to make it clearer that the rows can be clicked on.... However, I only want to change the pointer if I know...
3
3995
by: JohnR | last post by:
I have a form with a number of text boxes, comboboxes etc. What I would like to do is create an event handler for the "mouseenter" event for each of the controls whereby I display information about the control they just entered (sort of like an extended tooltip). Now, I can certainly create a separate mouseenter event for each control (too much work, and not very clever), but what I would like to do is somehow create one event that would...
0
1104
by: Event handle problem in C# | last post by:
Hello, may be some of you could help me. I have a winform with FormBorderStyle asigned to None (I need it in that way), and an AXWebBrowser with Dock asigned to Fill. My problem is that the MouseEnter event for the winform only work if I have a part of it visible, but in this case I must have the webbroser filling all the winform, so the event MouseEnter never work. And the webbrowser doen't have a MouseEnter event, so I can't call that...
3
1058
by: John | last post by:
Hello, Is there a way I can reference the button control that activated the mouseenter event? My buttons are created at runtime so i do not know any names. I was hoping to use Me.ActiveControl but this only works if the button is clicked.
4
3818
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've a MouseEnter event on a dataGrid, and I want to know, if the mouse entered column no. 0 or column no. 1 . How can it be done? Thanks, Gidi.
3
2700
by: Zabto | last post by:
I created an array of 8X5 boxes to represents pixels in a character. Each box is a custom UserControl of a fixed size which is filled black if it's activated, or white if it's not. I wanted to change multiple boxes with a click and drag. On mouse down I toggle the value of the current box and then set two static variables for the class: ButtonDown = true; Activate = (true or false, depending upon which action was just taken.) The...
0
9698
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, 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...
0
10527
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, 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...
0
10300
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10057
tracyyun
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...
0
9106
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, 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...
1
7595
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 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...
0
5619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2963
bsmnconsultancy
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.