Share via


HOW TO:在設計階段設定 Windows Form 上控制項的工具提示

更新:2007 年 11 月

您可以在程式碼或 Windows Form 設計工具中設定 ToolTip 字串。如需 ToolTip 元件的詳細資訊,請參閱 ToolTip 元件概觀 (Windows Form)

注意事項:

根據您目前使用的設定或版本,您所看到的對話方塊與功能表指令可能會與 [說明] 中描述的不同。如果要變更設定,請從 [工具] 功能表中選擇 [匯入和匯出設定]。如需詳細資訊,請參閱 Visual Studio 設定

若要以程式設計方式設定工具提示

  1. 加入要顯示工具提示的控制項。

  2. 使用 ToolTip 元件的 SetToolTip 方法。

    ' 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");
    
    // In this example, button1 is the control to display the ToolTip.
    toolTip1->SetToolTip(button1, "Save changes");
    

在設計工具中設定工具提示

  1. 在表單中加入 ToolTip 元件。

  2. 選取顯示工具提示的控制項,或將它加入至表單。

  3. 在 [屬性] 視窗中,將 [ToolTip1 的工作提示] 值設定為適當的文字字串。

請參閱

工作

HOW TO:變更 Windows Form ToolTip 元件的延遲時間

參考

ToolTip 元件概觀 (Windows Form)

其他資源

ToolTip 元件 (Windows Form)