Export (0) Print
Expand All

SystemPens Class

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.

System.Object
  System.Drawing.SystemPens

Namespace:  System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

public sealed class SystemPens

The SystemPens type exposes the following members.

  NameDescription
Public propertyStatic memberActiveBorderGets a Pen that is the color of the active window's border.
Public propertyStatic memberActiveCaptionGets a Pen that is the color of the background of the active window's title bar.
Public propertyStatic memberActiveCaptionTextGets a Pen that is the color of the text in the active window's title bar.
Public propertyStatic memberAppWorkspaceGets a Pen that is the color of the application workspace.
Public propertyStatic memberButtonFaceGets a Pen that is the face color of a 3-D element.
Public propertyStatic memberButtonHighlightGets a Pen that is the highlight color of a 3-D element.
Public propertyStatic memberButtonShadowGets a Pen that is the shadow color of a 3-D element.
Public propertyStatic memberControlGets a Pen that is the face color of a 3-D element.
Public propertyStatic memberControlDarkGets a Pen that is the shadow color of a 3-D element.
Public propertyStatic memberControlDarkDarkGets a Pen that is the dark shadow color of a 3-D element.
Public propertyStatic memberControlLightGets a Pen that is the light color of a 3-D element.
Public propertyStatic memberControlLightLightGets a Pen that is the highlight color of a 3-D element.
Public propertyStatic memberControlTextGets a Pen that is the color of text in a 3-D element.
Public propertyStatic memberDesktopGets a Pen that is the color of the Windows desktop.
Public propertyStatic memberGradientActiveCaptionGets a Pen that is the lightest color in the color gradient of an active window's title bar.
Public propertyStatic memberGradientInactiveCaptionGets a Pen that is the lightest color in the color gradient of an inactive window's title bar.
Public propertyStatic memberGrayTextGets a Pen that is the color of dimmed text.
Public propertyStatic memberHighlightGets a Pen that is the color of the background of selected items.
Public propertyStatic memberHighlightTextGets a Pen that is the color of the text of selected items.
Public propertyStatic memberHotTrackGets a Pen that is the color used to designate a hot-tracked item.
Public propertyStatic memberInactiveBorderGets a Pen is the color of the border of an inactive window.
Public propertyStatic memberInactiveCaptionGets a Pen that is the color of the title bar caption of an inactive window.
Public propertyStatic memberInactiveCaptionTextGets a Pen that is the color of the text in an inactive window's title bar.
Public propertyStatic memberInfoGets a Pen that is the color of the background of a ToolTip.
Public propertyStatic memberInfoTextGets a Pen that is the color of the text of a ToolTip.
Public propertyStatic memberMenuGets a Pen that is the color of a menu's background.
Public propertyStatic memberMenuBarGets a Pen that is the color of the background of a menu bar.
Public propertyStatic memberMenuHighlightGets a Pen that is the color used to highlight menu items when the menu appears as a flat menu.
Public propertyStatic memberMenuTextGets a Pen that is the color of a menu's text.
Public propertyStatic memberScrollBarGets a Pen that is the color of the background of a scroll bar.
Public propertyStatic memberWindowGets a Pen that is the color of the background in the client area of a window.
Public propertyStatic memberWindowFrameGets a Pen that is the color of a window frame.
Public propertyStatic memberWindowTextGets a Pen that is the color of the text in the client area of a window.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodStatic memberFromSystemColorCreates a Pen from the specified Color.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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.

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);
    }

}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft