ComponentOne Menus and Toolbars for WinForms
C1.Win.C1SuperTooltip.4.8 Assembly / C1.Win.C1SuperTooltip Namespace / C1SuperTooltip Class / SetToolTip Method / SetToolTip(Control,String) Method
The Control to associate the tooltip text with.
The tooltip text to display when the mouse cursor is over the control.
Example

In This Topic
    SetToolTip(Control,String) Method
    In This Topic
    Associates tooltip HTML text with the specified control. The Control to associate the tooltip text with. The tooltip text to display when the mouse cursor is over the control.
    Syntax
    'Declaration
     
    Public Overloads Sub SetToolTip( _
       ByVal control As System.Windows.Forms.Control, _
       ByVal text As System.String _
    ) 
    public void SetToolTip( 
       System.Windows.Forms.Control control,
       System.string text
    )

    Parameters

    control
    The Control to associate the tooltip text with.
    text
    The tooltip text to display when the mouse cursor is over the control.
    Remarks

    In addition to specifying the tooltip text to display for a control, you can also use this method to modify the tooltip text for a control. Calling the SetToolTip method more than once for a given control does not specify multiple tooltip text to display for a control but instead changes the current tooltip text for the control.

    To determine the tooltip text that is associated with a control at run time, you can use the GetToolTip(Control) method.

    C1SuperTooltip can display HTML text, including cascading style sheets, lists, tables, and images. To include images in your tooltips, use an <img> tag as usual, for example:

    <img src='[resourcename]'/>

    where [resourcename] is the name of an embedded resource that contains the image. The second example below illustrates this.

    Example
    The code below associates an HTML snippet with a ListBox control. The HTML contains two lines of text with some bold words in it. The code below associates an HTML snippet with a RichTextBox control. The HTML contains a table with two columns. The first column contains an image, loaded from the application's resources. In this case, the application must include an embedded resource named 'tips.gif'. The second column contains some formatted text.
    _C1SuperTooltip1.SetToolTip(this.listBox1,
      "This is a tip <b>with bold</b> text in it<br>it is also multi-line...");
    _C1SuperTooltip1.SetToolTip(richTextBox1,
      @"<table><tr>
      <td><img src='tips.gif'/></td>
      <td>This is a multiline<br>tooltip<br><b>associated
      </b><br>with the rich text box...</td>
      </tr></table>");
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also