แก้ไข

แชร์ผ่าน


Pens Class

Definition

Pens for all the standard colors. This class cannot be inherited.

public ref class Pens abstract sealed
public ref class Pens sealed
public static class Pens
public sealed class Pens
type Pens = class
Public Class Pens
Public NotInheritable Class Pens
Inheritance
Pens

Examples

The following method demonstrates how to use the Pens class. This example is designed to be used with Windows Forms. Paste the code into a form and call the UsePensClass method when handling the form's Paint event, passing e as PaintEventArgs.

private:
   void UsePensClass( PaintEventArgs^ e )
   {
      e->Graphics->DrawEllipse( Pens::SlateBlue, Rectangle(40,40,140,140) );
   }
private void UsePensClass(PaintEventArgs e)
{
    e.Graphics.DrawEllipse(Pens.SlateBlue, 
        new Rectangle(40, 40, 140, 140));
}
Private Sub UsePensClass(ByVal e As PaintEventArgs)
    e.Graphics.DrawEllipse(Pens.SlateBlue, _
        New Rectangle(40, 40, 140, 140))
End Sub

Remarks

The Pen objects returned by this class are immutable, meaning their properties cannot be changed. For the colors represented by the pens in this class, see List of colors by name.

Note

In .NET 6 and later versions, the System.Drawing.Common package, which includes this type, is only supported on Windows operating systems. Use of this type in cross-platform apps causes compile-time warnings and run-time exceptions. For more information, see System.Drawing.Common only supported on Windows.

Properties

AliceBlue

A system-defined Pen object with a width of 1.

AntiqueWhite

A system-defined Pen object with a width of 1.

Aqua

A system-defined Pen object with a width of 1.

Aquamarine

A system-defined Pen object with a width of 1.

Azure

A system-defined Pen object with a width of 1.

Beige

A system-defined Pen object with a width of 1.

Bisque

A system-defined Pen object with a width of 1.

Black

A system-defined Pen object with a width of 1.

BlanchedAlmond

A system-defined Pen object with a width of 1.

Blue

A system-defined Pen object with a width of 1.

BlueViolet

A system-defined Pen object with a width of 1.

Brown

A system-defined Pen object with a width of 1.

BurlyWood

A system-defined Pen object with a width of 1.

CadetBlue

A system-defined Pen object with a width of 1.

Chartreuse

A system-defined Pen object with a width of 1.

Chocolate

A system-defined Pen object with a width of 1.

Coral

A system-defined Pen object with a width of 1.

CornflowerBlue

A system-defined Pen object with a width of 1.

Cornsilk

A system-defined Pen object with a width of 1.

Crimson

A system-defined Pen object with a width of 1.

Cyan

A system-defined Pen object with a width of 1.

DarkBlue

A system-defined Pen object with a width of 1.

DarkCyan

A system-defined Pen object with a width of 1.

DarkGoldenrod

A system-defined Pen object with a width of 1.

DarkGray

A system-defined Pen object with a width of 1.

DarkGreen

A system-defined Pen object with a width of 1.

DarkKhaki

A system-defined Pen object with a width of 1.

DarkMagenta

A system-defined Pen object with a width of 1.

DarkOliveGreen

A system-defined Pen object with a width of 1.

DarkOrange

A system-defined Pen object with a width of 1.

DarkOrchid

A system-defined Pen object with a width of 1.

DarkRed

A system-defined Pen object with a width of 1.

DarkSalmon

A system-defined Pen object with a width of 1.

DarkSeaGreen

A system-defined Pen object with a width of 1.

DarkSlateBlue

A system-defined Pen object with a width of 1.

DarkSlateGray

A system-defined Pen object with a width of 1.

DarkTurquoise

A system-defined Pen object with a width of 1.

DarkViolet

A system-defined Pen object with a width of 1.

DeepPink

A system-defined Pen object with a width of 1.

DeepSkyBlue

A system-defined Pen object with a width of 1.

DimGray

A system-defined Pen object with a width of 1.

DodgerBlue

A system-defined Pen object with a width of 1.

Firebrick

A system-defined Pen object with a width of 1.

FloralWhite

A system-defined Pen object with a width of 1.

ForestGreen

A system-defined Pen object with a width of 1.

Fuchsia

A system-defined Pen object with a width of 1.

Gainsboro

A system-defined Pen object with a width of 1.

GhostWhite

A system-defined Pen object with a width of 1.

Gold

A system-defined Pen object with a width of 1.

Goldenrod

A system-defined Pen object with a width of 1.

Gray

A system-defined Pen object with a width of 1.

Green

A system-defined Pen object with a width of 1.

GreenYellow

A system-defined Pen object with a width of 1.

Honeydew

A system-defined Pen object with a width of 1.

HotPink

A system-defined Pen object with a width of 1.

IndianRed

A system-defined Pen object with a width of 1.

Indigo

A system-defined Pen object with a width of 1.

Ivory

A system-defined Pen object with a width of 1.

Khaki

A system-defined Pen object with a width of 1.

Lavender

A system-defined Pen object with a width of 1.

LavenderBlush

A system-defined Pen object with a width of 1.

LawnGreen

A system-defined Pen object with a width of 1.

LemonChiffon

A system-defined Pen object with a width of 1.

LightBlue

A system-defined Pen object with a width of 1.

LightCoral

A system-defined Pen object with a width of 1.

LightCyan

A system-defined Pen object with a width of 1.

LightGoldenrodYellow

A system-defined Pen object with a width of 1.

LightGray

A system-defined Pen object with a width of 1.

LightGreen

A system-defined Pen object with a width of 1.

LightPink

A system-defined Pen object with a width of 1.

LightSalmon

A system-defined Pen object with a width of 1.

LightSeaGreen

A system-defined Pen object with a width of 1.

LightSkyBlue

A system-defined Pen object with a width of 1.

LightSlateGray

A system-defined Pen object with a width of 1.

LightSteelBlue

A system-defined Pen object with a width of 1.

LightYellow

A system-defined Pen object with a width of 1.

Lime

A system-defined Pen object with a width of 1.

LimeGreen

A system-defined Pen object with a width of 1.

Linen

A system-defined Pen object with a width of 1.

Magenta

A system-defined Pen object with a width of 1.

Maroon

A system-defined Pen object with a width of 1.

MediumAquamarine

A system-defined Pen object with a width of 1.

MediumBlue

A system-defined Pen object with a width of 1.

MediumOrchid

A system-defined Pen object with a width of 1.

MediumPurple

A system-defined Pen object with a width of 1.

MediumSeaGreen

A system-defined Pen object with a width of 1.

MediumSlateBlue

A system-defined Pen object with a width of 1.

MediumSpringGreen

A system-defined Pen object with a width of 1.

MediumTurquoise

A system-defined Pen object with a width of 1.

MediumVioletRed

A system-defined Pen object with a width of 1.

MidnightBlue

A system-defined Pen object with a width of 1.

MintCream

A system-defined Pen object with a width of 1.

MistyRose

A system-defined Pen object with a width of 1.

Moccasin

A system-defined Pen object with a width of 1.

NavajoWhite

A system-defined Pen object with a width of 1.

Navy

A system-defined Pen object with a width of 1.

OldLace

A system-defined Pen object with a width of 1.

Olive

A system-defined Pen object with a width of 1.

OliveDrab

A system-defined Pen object with a width of 1.

Orange

A system-defined Pen object with a width of 1.

OrangeRed

A system-defined Pen object with a width of 1.

Orchid

A system-defined Pen object with a width of 1.

PaleGoldenrod

A system-defined Pen object with a width of 1.

PaleGreen

A system-defined Pen object with a width of 1.

PaleTurquoise

A system-defined Pen object with a width of 1.

PaleVioletRed

A system-defined Pen object with a width of 1.

PapayaWhip

A system-defined Pen object with a width of 1.

PeachPuff

A system-defined Pen object with a width of 1.

Peru

A system-defined Pen object with a width of 1.

Pink

A system-defined Pen object with a width of 1.

Plum

A system-defined Pen object with a width of 1.

PowderBlue

A system-defined Pen object with a width of 1.

Purple

A system-defined Pen object with a width of 1.

Red

A system-defined Pen object with a width of 1.

RosyBrown

A system-defined Pen object with a width of 1.

RoyalBlue

A system-defined Pen object with a width of 1.

SaddleBrown

A system-defined Pen object with a width of 1.

Salmon

A system-defined Pen object with a width of 1.

SandyBrown

A system-defined Pen object with a width of 1.

SeaGreen

A system-defined Pen object with a width of 1.

SeaShell

A system-defined Pen object with a width of 1.

Sienna

A system-defined Pen object with a width of 1.

Silver

A system-defined Pen object with a width of 1.

SkyBlue

A system-defined Pen object with a width of 1.

SlateBlue

A system-defined Pen object with a width of 1.

SlateGray

A system-defined Pen object with a width of 1.

Snow

A system-defined Pen object with a width of 1.

SpringGreen

A system-defined Pen object with a width of 1.

SteelBlue

A system-defined Pen object with a width of 1.

Tan

A system-defined Pen object with a width of 1.

Teal

A system-defined Pen object with a width of 1.

Thistle

A system-defined Pen object with a width of 1.

Tomato

A system-defined Pen object with a width of 1.

Transparent

A system-defined Pen object with a width of 1.

Turquoise

A system-defined Pen object with a width of 1.

Violet

A system-defined Pen object with a width of 1.

Wheat

A system-defined Pen object with a width of 1.

White

A system-defined Pen object with a width of 1.

WhiteSmoke

A system-defined Pen object with a width of 1.

Yellow

A system-defined Pen object with a width of 1.

YellowGreen

A system-defined Pen object with a width of 1.

Applies to

See also