SystemPens.HighlightText 属性

定义

获取一个 Pen 结构,它为选定项的文本颜色。Gets a Pen that is the color of the text of selected items.

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

属性值

Pen

一个 Pen,它是选定项的文本的颜色。A Pen that is the color of the text of selected items.

示例

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

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

End Sub

注解

选定的项可能包含菜单项和选定文本。Selected items may include menu items as well as selected text. 例如,笔可能是列表框中选定项的文本所使用的颜色。For example, the pen may be the color used for the text of selected items in a list box.

适用于