次の方法で共有


DrawToolTipEventArgs.Font プロパティ

定義

ToolTipの描画に使用するフォントを取得します。

public:
 property System::Drawing::Font ^ Font { System::Drawing::Font ^ get(); };
public System.Drawing.Font Font { get; }
public System.Drawing.Font? Font { get; }
member this.Font : System.Drawing.Font
Public ReadOnly Property Font As Font

プロパティ値

Font オブジェクト。

次のコード例では、 ToolTipをカスタム描画する方法を示します。 この例では、ToolTipを作成し、Formにある 3 つのButton コントロールに関連付けます。 この例では、 OwnerDraw プロパティを true に設定し、 Draw イベントを処理します。 Draw イベント ハンドラーでは、ToolTipは、DrawToolTipEventArgs.AssociatedControl プロパティで示されているように、ToolTipが表示されているボタンに応じて、異なる方法で描画されるカスタムです。

次のコード抜粋は、 DrawBorderDrawBackground、および DrawText メソッドの使用を示しています。 完全なコード例については、 DrawToolTipEventArgs クラスの概要を参照してください。

// Draw the ToolTip using default values if the ToolTip is for button3.
else if ( e->AssociatedControl == button3 )
{
   e->DrawBackground();
   e->DrawBorder();
   e->DrawText();
}
// Draw the ToolTip using default values if the ToolTip is for button3.
else if (e.AssociatedControl == button3)
{
    e.DrawBackground();
    e.DrawBorder();
    e.DrawText();
}
ElseIf (e.AssociatedControl Is button3) Then
    ' Draw the ToolTip using default values if the ToolTip is for button3.
    e.DrawBackground()
    e.DrawBorder()
    e.DrawText()
End If

注釈

Windows の既定のフォントを使用するToolTipをカスタム描画する場合は、Font プロパティを使用します。

適用対象

こちらもご覧ください