CreatePen

Syntax

HPEN CreatePen(nPenStyle,nWidth,crColor)

This function creates a logical pen having the specified style, width, and color. The pen can be subsequently selected as the current pen for any device.

Parameter Type/Description  
nPenStyle int Specifies the pen style. It can be any one of the following values:  
  Pen Style Value
  PS_SOLID 0
  PS_DASH 1
  PS_DOT 2
  PS_DASHDOT 3
  PS_DASHDOTDOT 4
  PS_NULL 5
  PS_INSIDEFRAME 6
If the width of the pen is greater than 1 and the pen style is PS_INSIDEFRAME, the line is drawn inside the frame of all primitives except polygons and polylines; the pen is drawn with a logical (dithered) color if the pen color does not match an available RGB value. The PS_INSIDEFRAME style is identical to PS_SOLID if the pen width is less than or equal to 1.  
nWidth int Specifies the width of the pen (in logical units).  
crColor COLORREF Specifies the color of the pen.  

Return Value

The return value identifies a logical pen if the function is successful. Otherwise, it is NULL.

Comments

Pens with a physical width greater than one pixel will always have either null or solid style or will be dithered if the pen style is PS_INSIDEFRAME.