SystemPens.ActiveCaption 属性

定义

获取表示活动窗口标题栏背景颜色的 PenGets a Pen that is the color of the background of the active window's title bar.

public:
 static property System::Drawing::Pen ^ ActiveCaption { System::Drawing::Pen ^ get(); };
public static System.Drawing.Pen ActiveCaption { get; }
member this.ActiveCaption : System.Drawing.Pen
Public Shared ReadOnly Property ActiveCaption As Pen

属性值

Pen

一个 Pen,它是活动窗口标题栏的背景的颜色。A Pen that is the color of the background of the active window's title bar.

示例

下面的代码示例演示如何使用 ActiveCaption 属性。The following code example demonstrates how to use the ActiveCaption property. 若要运行此示例,请将其粘贴到 Windows 窗体中。To run this example, paste it into a Windows Form. 处理窗体的 Paint 事件,并 DrawWithActiveCaptionPenPaint 事件处理方法调用方法,并将 e 作为传递 PaintEventArgsHandle the form's Paint event and call the DrawWithActiveCaptionPen method from the Paint event-handling method, passing e as PaintEventArgs.

private void DrawWithActiveCaptionPen(PaintEventArgs e)
{
    Rectangle rectangle1 = new Rectangle(10, 10, 100, 100);
    e.Graphics.DrawRectangle(SystemPens.ActiveCaption, rectangle1);
}
Private Sub DrawWithActiveCaptionPen(ByVal e As PaintEventArgs) 
    Dim rectangle1 As New Rectangle(10, 10, 100, 100)
    e.Graphics.DrawRectangle(SystemPens.ActiveCaption, rectangle1)

End Sub

适用于