方法: Windows フォーム上のコントロールのツールヒントをデザイン時に設定する
ToolTip の文字列は、コードまたは Visual Studio の Windows フォーム デザイナーで設定できます。 ToolTip コンポーネントについて詳しくは、「ToolTip コンポーネントの概要」を参照してください。
ツールヒントをプログラムによって設定する
ツールヒントを表示するコントロールを追加します。
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");
ツールヒントをデザイナーで設定する
Visual Studio で、ToolTip コンポーネントをフォームに追加します。
ツールヒントを表示するコントロールを選択するか、フォームに追加します。
[プロパティ] ウィンドウで、 [ToolTip1 の ToolTip] の値を適切なテキスト文字列に設定します。
ツールヒントをプログラムによって削除するには
ToolTip コンポーネントの SetToolTip メソッドを使用します。
' 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 の ToolTip] のテキストを削除します。
関連項目
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET Desktop feedback