Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > MouseDown event not firing for child controls
 

MouseDown event not firing for child controls

I need to know the control on which the mouse has been clicked in a container.
If I use the mouseDown event of the control this event gets fired and by using

c =
this.GetChildAtPoint(panel1.PointToClient(MousePosition)) I get the control details.

But when I try put try this from Form1_MouseDown or Panel1_MouseDown event I am not able to get the control.
I need this because there are a number of controls and I cannot code for each controls mouseDown event.

I am basically trying to drag drop the labels around a container and swap their positions.

How can I get to know which child control has been clicked & similarly the control with wich it wil be swaped?

Please let me know the events to use and the code if I am wrong above.

Hope this helps !!
Sudeep My Blog
Sudeep Raj  Thursday, October 01, 2009 10:09 AM
Hi Sudeep,

You can follow the sample below to hook up the mouse events:
http://www.codeproject.com/KB/cs/netwin32hooks.aspx

Regards,
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Wednesday, October 07, 2009 10:05 AM
Hi Sudeep,

You can follow the sample below to hook up the mouse events:
http://www.codeproject.com/KB/cs/netwin32hooks.aspx

Regards,
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Wednesday, October 07, 2009 10:05 AM

You can use google to search for other answers

Custom Search

More Threads

• No one knows how to do this?
• ProcessDialogKey doesn't get called
• Simple question on ComboBox Databinding look up.
• Combobox in Gridview help
• DatgridView add rows...?
• DataGridViewRow.ErrorText disappears on filtering
• How to delete a group of rows from a DataTable?
• Data Manipulation in DataGridView
• How do I save data entered into multiple rows in a datagridview
• Can I bind DataGridView to my objects?