A | B | C |  D | E | F |  G | H | I |  J | K | L |  M | N | O |  P | Q | R |  S | T | U |  V | W | X |  Y | Z



CreatePen

The CreatePen function creates a logical pen that has the specified style, width, and color. The pen can subsequently be selected into a device context and used to draw lines and curves.

VB4-32,5,6
Declare Function CreatePen Lib "gdi32" Alias "CreatePen" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long

VB.NET
System.Drawing.Pen

Operating Systems Supported
Requires Windows NT 3.1 or later; Requires Windows 95 or later

Library
Gdi32

Parameter Information
- fnPenStyle
Specifies the pen style. It can be any one of the following values:
PS_SOLID
Pen is solid.
PS_DASH
Pen is dashed. This style is valid only when the pen width is one or less in device units.
PS_DOT
Pen is dotted. This style is valid only when the pen width is one or less in device units.
PS_DASHDOT
Pen has alternating dashes and dots. This style is valid only when the pen width is one or less in device units.
PS_DASHDOTDOT
Pen has alternating dashes and double dots. This style is valid only when the pen width is one or less in device units.
PS_NULL
Pen is invisible.
PS_INSIDEFRAME
Pen is solid. When this pen is used in any graphics device interface (GDI) drawing function that takes a bounding rectangle, the dimensions of the figure are shrunk so that it fits entirely in the bounding rectangle, taking into account the width of the pen. This applies only to geometric pens.

- nWidth
Specifies the width of the pen, in logical units. If nWidth is zero, the pen is a single pixel wide, regardless of the current transformation.

- crColor
Specifies a color reference for the pen color.

Return Values
If the function succeeds, the return value is a handle that identifies a logical pen.

If the function fails, the return value is NULL.

Last update: 07 April 2006