PDA

Click to See Complete Forum and Search --> : Usercontrol Events


EamonH
Aug 5th, 2002, 02:32 AM
I have a question about usercontrol events, specifically the mouse Enter/Leave events.

I have a usercontrol which I want to highlight when the mouse is over it. I am using the MouseEnter and MouseLeave events to acheive this and this works fine as long as I don't have any other controls on the usercontrol.

If however, I place another control, say a button or a label, onto the usercontrol, the mouseLeave event fires when I move over the button, even though the button is part of the usercontrol. I suppose technically the mouse has left the usercontrol and entered the button control, but I don't want it to act as though it has left the usercontrol unless it leaves the external boundries of the usercontrol.

I know that I could just call the usercontrol's MouseEnter event from the button's MouseEnter handler, but it seems like excessive processing(especially if I was doing more than highlighting the control). I don't want to call up all the usercontrol's events from every other control on the usercontrol.

Is there a better way? There has to be, surely?

Eamon