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 根据 显示的按钮 ToolTip ,以不同的方式自定义绘制,如 属性所示 DrawToolTipEventArgs.AssociatedControl

下面的代码摘录演示了 DrawBorder如何使用 、 DrawBackgroundDrawText 方法。 有关完整的代码示例, 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 默认字体的 时,请使用 属性。

适用于

另请参阅