Create a tooltip for a custom UserControl

I need to understand how to use ToolTip with a custom UserControl . Just creating a ToolTip on the form and assigning a specific ToolTip control (via SetToolTip ) will obviously not work.

What properties do I need to provide a custom UserControl to assign ToolTip text to it? Do I need to add a tooltip to the usercontrol form? How can i do this?

Please provide a sample code or something for me to render.

Thanks!

+6
source share
1 answer

Put the tooltip in your UserControl (use the constructor, just like you would put it on the form) and add a public property to your UserControl, for example:

  public string TextBoxHint { get { return toolTip1.GetToolTip(textBox1); } set { toolTip1.SetToolTip(textBox1, value); } } 
+8
source

Source: https://habr.com/ru/post/904192/


All Articles