There are three predefined pens available in GDI: black, null, or white. An application selects any one of them by using the GetStockObject function.
An application can create an original pen by using the CreatePen function. This function allows the application to select one of six pen styles, a pen width, and a pen color (if the device has color capabilities). The pen style can be solid, dashed, or dotted; it can combine an alternating dot and dash or two dots and a dash; or it can be null. The pen width is the number of logical units GDI maps to a specific number of pixels (this number is dependent on the current mapping mode if the pen is selected into a device context). The pen color is an RGB (red, green, blue) color value. The following figure shows a variety of pen patterns obtained from calls to CreatePen: