How to embed a custom control into the ToolTip for the associated control.

The following code demonstrates how to do it.

C# Copy imageCopy
public TestForm()
{
    InitializeComponent();

    //Initialize tooltip
    toolTip.TitleIcon = Resources.about; //Set some icon from resources
    toolTip.AutoSize = false;
    toolTip.Resizable = true;
    toolTip.CloseButton = true;
    toolTip.Title = "Custom control in the tooltip";

    //Set a custom control and assotiate the tip with the button2
    TextBox textBox = new TextBox();
    textBox.Multiline = true;
    toolTip[button2].CustomControl = textBox;
    toolTip[button2].Location = new Point(button2.Size.Width, 0);
}

Back to .Net ToolTip HowTo topics