Share via


DrawToolTipEventArgs.DrawBorder 方法

定義

使用系統的框線色彩來繪製 ToolTip 的框線。

public:
 void DrawBorder();
public void DrawBorder ();
member this.DrawBorder : unit -> unit
Public Sub DrawBorder ()

範例

下列程式碼範例示範如何自訂繪製 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

備註

當您想要自訂 的特定視覺層面 ToolTip 時,請使用這個方法,但想要使用 目前的 值 SystemColors.WindowFrame 為您繪製標準工具提示框線。 框線會繪製到 屬性所 Bounds 指定的大小。 您可以藉由處理 事件,在顯示之前增加 其 Popup 界限 ToolTip

適用於