SystemPens SystemPens SystemPens SystemPens Class

Definition

Each property of the SystemPens class is a Pen that is the color of a Windows display element and that has a width of 1 pixel.

public ref class SystemPens sealed
public sealed class SystemPens
type SystemPens = class
Public NotInheritable Class SystemPens
Inheritance
SystemPensSystemPensSystemPensSystemPens

Examples

The following code example creates points and sizes using several of the overloaded operators defined for these types. It also demonstrates how to use the SystemPens class.

This example is designed to be used with Windows Forms. Create a form that contains a Button named subtractButton. Paste the code into the form and call the CreatePointsAndSizes method from the form's Paint event-handling method, passing e as PaintEventArgs.

void CreatePointsAndSizes( PaintEventArgs^ e )
{
   // Create the starting point.
   Point startPoint = Point(subtractButton->Size);
   
   // Use the addition operator to get the end point.
   Point endPoint = startPoint + System::Drawing::Size( 140, 150 );
   
   // Draw a line between the points.
   e->Graphics->DrawLine( SystemPens::Highlight, startPoint, endPoint );
   
   // Convert the starting point to a size and compare it to the
   // subtractButton size.  
   System::Drawing::Size buttonSize = (System::Drawing::Size)startPoint;
   if ( buttonSize == subtractButton->Size )
   {
      e->Graphics->DrawString( "The sizes are equal.", gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), Brushes::Indigo, 10.0F, 65.0F );
   }
}
private void CreatePointsAndSizes(PaintEventArgs e)
{

    // Create the starting point.
    Point startPoint = new Point(subtractButton.Size);

    // Use the addition operator to get the end point.
    Point endPoint = startPoint + new Size(140, 150);

    // Draw a line between the points.
    e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint);

    // Convert the starting point to a size and compare it to the
    // subtractButton size.  
    Size buttonSize = (Size)startPoint;
    if (buttonSize == subtractButton.Size)

        // If the sizes are equal, tell the user.
    {
        e.Graphics.DrawString("The sizes are equal.", 
            new Font(this.Font, FontStyle.Italic), 
            Brushes.Indigo, 10.0F, 65.0F);
    }

}
Private Sub CreatePointsAndSizes(ByVal e As PaintEventArgs)

    ' Create the starting point.
    Dim startPoint As New Point(subtractButton.Size)

    ' Use the addition operator to get the end point.
    Dim endPoint As Point = Point.op_Addition(startPoint, _
        New Size(140, 150))

    ' Draw a line between the points.
    e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint)

    ' Convert the starting point to a size and compare it to the
    ' subtractButton size.  
    Dim buttonSize As Size = Point.op_Explicit(startPoint)
    If (Size.op_Equality(buttonSize, subtractButton.Size)) Then

        ' If the sizes are equal, tell the user.
        e.Graphics.DrawString("The sizes are equal.", _
            New Font(Me.Font, FontStyle.Italic), _
            Brushes.Indigo, 10.0F, 65.0F)
    End If

End Sub

Properties

ActiveBorder ActiveBorder ActiveBorder ActiveBorder

Gets a Pen that is the color of the active window's border.

ActiveCaption ActiveCaption ActiveCaption ActiveCaption

Gets a Pen that is the color of the background of the active window's title bar.

ActiveCaptionText ActiveCaptionText ActiveCaptionText ActiveCaptionText

Gets a Pen that is the color of the text in the active window's title bar.

AppWorkspace AppWorkspace AppWorkspace AppWorkspace

Gets a Pen that is the color of the application workspace.

ButtonFace ButtonFace ButtonFace ButtonFace

Gets a Pen that is the face color of a 3-D element.

ButtonHighlight ButtonHighlight ButtonHighlight ButtonHighlight

Gets a Pen that is the highlight color of a 3-D element.

ButtonShadow ButtonShadow ButtonShadow ButtonShadow

Gets a Pen that is the shadow color of a 3-D element.

Control Control Control Control

Gets a Pen that is the face color of a 3-D element.

ControlDark ControlDark ControlDark ControlDark

Gets a Pen that is the shadow color of a 3-D element.

ControlDarkDark ControlDarkDark ControlDarkDark ControlDarkDark

Gets a Pen that is the dark shadow color of a 3-D element.

ControlLight ControlLight ControlLight ControlLight

Gets a Pen that is the light color of a 3-D element.

ControlLightLight ControlLightLight ControlLightLight ControlLightLight

Gets a Pen that is the highlight color of a 3-D element.

ControlText ControlText ControlText ControlText

Gets a Pen that is the color of text in a 3-D element.

Desktop Desktop Desktop Desktop

Gets a Pen that is the color of the Windows desktop.

GradientActiveCaption GradientActiveCaption GradientActiveCaption GradientActiveCaption

Gets a Pen that is the lightest color in the color gradient of an active window's title bar.

GradientInactiveCaption GradientInactiveCaption GradientInactiveCaption GradientInactiveCaption

Gets a Pen that is the lightest color in the color gradient of an inactive window's title bar.

GrayText GrayText GrayText GrayText

Gets a Pen that is the color of dimmed text.

Highlight Highlight Highlight Highlight

Gets a Pen that is the color of the background of selected items.

HighlightText HighlightText HighlightText HighlightText

Gets a Pen that is the color of the text of selected items.

HotTrack HotTrack HotTrack HotTrack

Gets a Pen that is the color used to designate a hot-tracked item.

InactiveBorder InactiveBorder InactiveBorder InactiveBorder

Gets a Pen is the color of the border of an inactive window.

InactiveCaption InactiveCaption InactiveCaption InactiveCaption

Gets a Pen that is the color of the title bar caption of an inactive window.

InactiveCaptionText InactiveCaptionText InactiveCaptionText InactiveCaptionText

Gets a Pen that is the color of the text in an inactive window's title bar.

Info Info Info Info

Gets a Pen that is the color of the background of a ToolTip.

InfoText InfoText InfoText InfoText

Gets a Pen that is the color of the text of a ToolTip.

Menu Menu Menu Menu

Gets a Pen that is the color of a menu's background.

MenuBar MenuBar MenuBar MenuBar

Gets a Pen that is the color of the background of a menu bar.

MenuHighlight MenuHighlight MenuHighlight MenuHighlight

Gets a Pen that is the color used to highlight menu items when the menu appears as a flat menu.

MenuText MenuText MenuText MenuText

Gets a Pen that is the color of a menu's text.

ScrollBar ScrollBar ScrollBar ScrollBar

Gets a Pen that is the color of the background of a scroll bar.

Window Window Window Window

Gets a Pen that is the color of the background in the client area of a window.

WindowFrame WindowFrame WindowFrame WindowFrame

Gets a Pen that is the color of a window frame.

WindowText WindowText WindowText WindowText

Gets a Pen that is the color of the text in the client area of a window.

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
FromSystemColor(Color) FromSystemColor(Color) FromSystemColor(Color) FromSystemColor(Color)

Creates a Pen from the specified Color.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to