c# - Iterating through tooltips -


Friends, I have a panel control and inside the control of the panel there are many other controls with a system. Form linked with them How can I be repeated through each tooltip and set tooltip's active property to false? Tooltips, unlike other controls, are not really controls, I had this:

  foreach (system.Windows.Forms.Control ctrl in this.pnlControl.Controls) {if (ctrl Name.StartsWith ("tt")) // After all, my tooltip name 'tt' starts with {System.Windows.ToolTip TipControl = (System.Windows.Forms.ToolTip) ctrl; TipControl.Active = False; }}  

It does not work though it becomes an error because tooltip control is not found by the system. Any thoughts about Windows.Forms.Control?

EDIT: OK guys I probably did not go to detail enough to answer my problem is this, I'm taking control in my panel and taking them to a different panel. Once they are closed, tooltips are still connected to control, which I want. Although I do not have any way or after they are reactivated, they are changed once because the form and the original panel no longer exist. However, I found a solution that I will post here.

How to add tool tips for two buttons? Correctly doing two examples of tooltips like this:

  tooltip tt1 = new tooltip (); // or you can create one in designer tt1.ToolTipTitle = "test"; Tt1.SetToolTip (Button1, "Caption 1"); Tooltip tt2 = new tooltip (); Tt2.ToolTipTitle = "test2"; Tt2.SetToolTip (Button2, "Caption 2");  

Remember that the tooltip examples and controls are not related on one-on-one basis for this example:

  tooltip tt1 = new tooltip ( ); // or you can create one in designer tt1.ToolTipTitle = "test"; Tt1.SetToolTip (Button1, "Caption 1"); Tt1.SetToolTip (Button2, "Caption 2");  

To remove the tooltip for button 2, use it:

  tt1.SetToolTip (button2, string.optim);  

For your case, we use

  foreach (Control C. control in this) using {tt.SetToolTip (c, string.Empty) Can; }  

Comments