Good day. Several buttons are placed on the TableLayoutPanel. It is necessary, when you hover the mouse over the button, to display its tag in the label (located below). I did not understand how to use GetChildAtPoint , please tell me.
- You can do this: private void button1_MouseEnter (object sender, EventArgs e) {string send = ((Button) sender) .Tag.ToString (); string loc = ((Button) sender) .Location.ToString (); label1.Text = send + loc; } - Sergey_73
|
1 answer
Why use GetChildAtPoint if there is a MouseEnter event? You can set the same handler for any number of buttons (in code or in a designer), something like this:
private void TableLayoutPanelButton_MouseEnter(object sender, EventArgs e) { var tag = ((Button)sender).Tag; // делаем что нужно } |