wxPen

From WxWiki
Jump to: navigation, search
Official Classes SmallBlocks.png Archive Containers Controls Data Structures Database Date & Time Debug Device Contexts Dialogs Document & Views Drag & Drop Events Filesystem Frames Graphics Grid Cell Help HTML Logging Miscellaneous Networking Printing Sizers Streams Threading Windows

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.

Styles

wxSOLID
Lines are drawn solid.
wxTRANSPARENT
Used when no pen drawing is desired.
wxDOT
The line is drawn dotted.
wxLONG_DASH
Draws with a long dashed style.
wxSHORT_DASH
Draws with a short dashed style. On Windows, this is the same as wxLONG_SASH.
wxDOT_DASH
Draws with a dot and a dash.
wxSTIPPLE
Uses a stipple bitmap, which is passed as the first constructor argument.
wxUSER_DASH
Uses user-specified dashes. See the reference manual for further information.
wxBDIAGONAL_HATCH
Draws with a backward-diagonal hatch.
wxCROSSDIAG_HATCH
Draws with a cross-diagonal hatch.
wxFDIAGONAL_HATCH
Draws with a forward-diagonal hatch.
wxCROSS_HATCH
Draws with a cross hatch.
wxHORIZONTAL_HATCH
Draws with a horizontal hatch.
wxVERTICAL_HATCH
Draws with a vertical hatch.

See also