wxPen: wxObject

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. On a monochrome display, the default behaviour is to show all non-white pens as black. To change this, set the Colour member of the device context to TRUE, and select appropriate colours.

The style may be one of wxSOLID, wxDOT, wxLONG_DASH, wxSHORT_DASH and wxDOT_DASH. The names of these styles should be self explanatory.

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 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 FindOrCreatePen. See the entry for the wxPenList class.

wxPen::wxPen

voidwxPen

voidwxPenwxColour &colour, int style

voidwxPenchar *colour_name, int style

Constructs a pen, uninitialized, initialized with a width, initialized with an RGB colour, a width and a style, or initialized using a colour name, a width and a style. If the named colour form is used, an appropriate wxColour structure is found in the colour database.

wxPen::wxPen

voidwxPen

Destructor, destroying the pen. Note that pens should very rarely be deleted since windows may contain pointers to them. All pens will be deleted when the application terminates.

wxPen::GetColour

wxColour&GetColour

Returns a reference to the pen colour.

wxPen::GetStyle

intGetStyle

Returns the pen style.

wxPen::GetWidth

intGetWidth

Returns the pen width.

wxPen::SetColour

voidSetColourwxColour &colour

voidSetColourchar *colour_name

voidSetColourint red, int green, int blue

The pen's colour is changed to the given colour.

wxPen::SetStyle

voidSetStyleint style

Set the pen style (wxSOLID or wxTRANSPARENT).

wxPen::SetWidth

voidSetWidthint width

Set the pen width.