How do I tell which control the mouse has been clicked over?
问题 I have been looking around for a while for some code that tells what control the mouse has clicked. I have a Form with over 50 controls and I don't want to click each one to make a mouse clicked on. How would I do this? 回答1: You can use the Tag property of each control. So set it to something meaningful and on Click event do something like this: (sender As Control).Tag EDIT: Also you may do this: foreach (Control item in this.Controls) //this IS YOUR CURRENT FORM { if ((sender as Control)