Udostępnij przez


Instrukcje: ustawianie etykietek narzędzi dla kontrolek w formularzu systemu Windows w czasie projektowania

Możesz ustawić ciąg ToolTip w kodzie lub w narzędziu Windows Forms Designer w programie Visual Studio. Aby uzyskać więcej informacji na temat składnika ToolTip, zobacz ToolTip Component Overview.

Ustawianie ToolTip za pomocą programowania

  1. Dodaj kontrolkę, która będzie wyświetlać etykietkę narzędzia.

  2. Użyj metody SetToolTip składnika ToolTip.

    ' 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");
    

Ustawianie etykietki narzędzia w projektancie

  1. W programie Visual Studio dodaj składnik ToolTip do formularza.

  2. Wybierz kontrolkę, która wyświetli etykietkę narzędzia lub dodaj ją do formularza.

  3. W oknie właściwości ustaw wartość ToolTip on ToolTip1 na odpowiedni ciąg tekstu.

Aby programowo usunąć etykietkę narzędzia

  1. Użyj metody SetToolTip składnika ToolTip.

    ' 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);
    

Usuwanie etykietki narzędzia w projektancie

  1. W programie Visual Studio wybierz kontrolkę, która wyświetla podpowiedź narzędzia.

  2. W oknie właściwości usuń tekst w ToolTip on ToolTip1.

Zobacz także