- create / select graphic pen

Low-level graphics
(AmiBroker 50)

SYNTAX GfxSelectPen( color, width = 1, penstyle = penSolid )
FUNCTION GfxSelectPen initializes (if not already initialized) a pen with the specified style, width, and color. Then selects the pen as current for subsequent drawing operations.


  • color - specifies color for the pen
  • penstyle - specifies the style for the pen. Solid=0, Dash=1, Dot=2, Null=5 (invisible pen). Lines of width > 1 can only use solid style. For a list of other possible values, see the Microsoft docs on CreatePen Windows API function.
  • width - specifies the width of the pen. If this value is 0, the width in device units is always 1 pixel, regardless of the mapping mode (this is useful for drawing hairline lines on printer outputs).

More info on pens in Windows GDI:

NOTE: This is LOW-LEVEL graphic function. To learn more about low-level graphic functions please read TUTORIAL: Using low-level graphics.

EXAMPLE GfxSelectPen( colorGreen, 2 );
GfxSelectSolidBrush( colorYellow );
SEE ALSO GfxLineTo() function , GfxMoveTo() function , GfxSetPixel() function , GfxTextOut() function


The GfxSelectPen function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.