How do I remove a tooltip currently bound to a control?

前端 未结 6 1909
北荒
北荒 2020-12-20 12:12

I\'m currently adding a tooltip to a label like so:

ToolTip LabelToolTip = new System.Windows.Forms.ToolTip();
LabelToolTip.SetToolTip(this.LocationLabel, te         


        
6条回答
  •  执念已碎
    2020-12-20 12:43

    I had the same problem . I added a tooTip component In Design form and used it. I define a text like " " in Misc section in property window of the control I wanted to have tooltip text. After that , every time I changed the test of tooltip for my component it does not appear the previous test assigned and worked well .

    In the form code:

    public ToolTip toolTip1;
    

    (please note that when adding a toolTip to a form, code generator creates the above line , I changed its modifier to public since It was needed , but if you dont require it , do not change it)

    In program to change the tooltip text of control :

    toolTip1.SetToolTip(myControl, "The text I want to appear");
    

提交回复
热议问题