A pen is a drawing tool for drawing outlines.
It is used for drawing lines and painting the outline of rectangles, ellipses, etc. It has a colour, a width and a style.
Note: On a monochrome display, wxWidgets shows all non-white pens as black.
Do not initialize objects on the stack before the program commences, since other required structures may not have been set up yet. Instead, define global pointers to objects and create them in wxApp::OnInit() or when required.
An application may wish to dynamically create pens with different characteristics, and there is the consequent danger that a large number of duplicate pens will be created. Therefore an application may wish to get a pointer to a pen by using the global list of pens wxThePenList, and calling the member function wxPenList::FindOrCreatePen(). See wxPenList for more info.
This class uses reference counting and copy-on-write internally so that assignments between two instances of this class are very cheap. You can therefore use actual objects instead of pointers without efficiency problems. If an instance of this class is changed it will create its own data internally so that other instances, which previously shared the data using the reference counting, are not affected.
- Lines are drawn solid.
- Used when no pen drawing is desired.
- The line is drawn dotted.
- Draws with a long dashed style.
- Draws with a short dashed style. On Windows, this is the same as wxLONG_SASH.
- Draws with a dot and a dash.
- Uses a stipple bitmap, which is passed as the first constructor argument.
- Uses user-specified dashes. See the reference manual for further information.
- Draws with a backward-diagonal hatch.
- Draws with a cross-diagonal hatch.
- Draws with a forward-diagonal hatch.
- Draws with a cross hatch.
- Draws with a horizontal hatch.
- Draws with a vertical hatch.