通过


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 事件。 在事件处理程序中Draw,自定义的绘制方式不同,ToolTip具体取决于属性所指示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 默认字体的属性时,请使用该属性。

适用于

另请参阅