Share via


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 。 此範例會建立 ,並將它與位於 上的 FormButtonToolTip 控制項產生關聯。 此範例會將 OwnerDraw 屬性設定為 true,並處理 Draw 事件。 在 事件處理常式中 DrawToolTip 會根據 屬性所指示 DrawToolTipEventArgs.AssociatedControl 顯示的按鈕 ToolTip ,以不同的方式繪製 。

下列程式碼摘錄示範如何使用 DrawBorderDrawBackgroundDrawText 方法。 如需完整的程式碼範例, 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

備註

Font當您自訂繪製 ToolTip 應該使用 Windows 預設字型的 時,請使用 屬性。

適用於

另請參閱