Sdílet prostřednictvím


Postupy: Nastavení nástroje Tipy pro ovládací prvky ve formuláři Windows Při návrhu

Řetězec můžete nastavit ToolTip v kódu nebo v návrháři model Windows Forms v sadě Visual Studio. Další informace o komponentě ToolTip naleznete v tématu ToolTip Component Overview.

Programové nastavení popisu

  1. Přidejte ovládací prvek, který zobrazí popis.

  2. SetToolTip Použijte metodu ToolTip komponenty.

    ' In this example, Button1 is the control to display the ToolTip.
    ToolTip1.SetToolTip(Button1, "Save changes")
    
    // In this example, button1 is the control to display the ToolTip.
    toolTip1.SetToolTip(button1, "Save changes");
    
    // In this example, button1 is the control to display the ToolTip.
    toolTip1->SetToolTip(button1, "Save changes");
    

Nastavení popisu v návrháři

  1. V sadě Visual Studio přidejte do formuláře komponentu ToolTip .

  2. Vyberte ovládací prvek, který zobrazí popis, nebo ho přidejte do formuláře.

  3. V okně Vlastnosti nastavte popis u hodnoty ToolTip1 na odpovídající řetězec textu.

Odebrání popisu prostřednictvím kódu programu

  1. SetToolTip Použijte metodu ToolTip komponenty.

    ' In this example, Button1 is the control displaying the ToolTip.
    ToolTip1.SetToolTip(Button1, Nothing)
    
    // In this example, button1 is the control displaying the ToolTip.
    toolTip1.SetToolTip(button1, null);
    
    // In this example, button1 is the control displaying the ToolTip.
    toolTip1->SetToolTip(button1, NULL);
    

Odebrání popisu v návrháři

  1. V sadě Visual Studio vyberte ovládací prvek, který zobrazuje popis.

  2. V okně Vlastnosti odstraňte text v popisu v popisku 1.

Viz také