如何:在設計階段為 Windows Form 上的控制項設定工具提示
您可以在程式碼或 Visual Studio 的 Windows Forms 設計工具中設定 ToolTip 字串。 如需元件的詳細資訊 ToolTip ,請參閱 工具提示元件概觀 。
以程式設計方式設定工具提示
新增將顯示工具提示的控制項。
SetToolTip使用 元件的 方法 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");
在設計工具中設定工具提示
在 Visual Studio 中,將元件新增 ToolTip 至表單。
選取將顯示工具提示的控制項,或將它新增至表單。
在 [ 屬性] 視窗中,將 ToolTip1 值上的 ToolTip 設定 為適當的文字字串。
以程式設計方式移除工具提示
SetToolTip使用 元件的 方法 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);
移除設計工具中的工具提示
在 Visual Studio 中,選取顯示工具提示的控制項。
在 [ 屬性] 視窗中,刪除 ToolTip1 工具提示中的 文字。
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應