How to check if Mouse Click is in User Control without handling child control events?

.net, winforms

Solution

There is no way of bubbling events in WinForms like there is in HTML or in WPF

How do I grab events from sub-controls on a user-control in a WinForms App?

So you will always need to add extra code.

Problem

I have an User Control that host another controls like panel, chart controls. Right now i have implemented the Header Panel control's MouseClick event to capture the mouse event, but i need to capture mouse click or mouseDown event on the whole user control area. ``` pnlHeader.MouseUp += new MouseEventHandler(pnlHeader_MouseUp); //it is working //Not able to capture because child control coverup all area of the usercontrol. this.MouseDown += new MouseEventHandler(MyCustomControl_MouseDown); ``` I went through this SO thread, but it does not help me regarding mouse click or mouse down event. So what is correct and efficient way to capture user control mouse event?? Any idea or suggestion with some reference code(if possible) will be accepted. Thanks in advance.

Original source

Related problems