The V C++ GUI Framework:vPen

From EDM2
Jump to: navigation, search

A class to specify the pen used to draw lines and shapes.


Class name:


Pens are used to draw lines and the outlines of shapes. Pens have several attributes, including color, width, and style.


vPen(unsigned int r = 0, unsigned int g = 0, unsigned int b = 0, int width = 1, int style = vSolid)

The constructor for a pen allows you to specify the pen's color, width, and style. The default will construct a solid black pen of width 1.

int operator ==, !=

You can use the operators == and != for comparisons.

vColor GetColor()

This method returns the current color of the pen as a vColor object.

int GetStyle()

This method returns the current style of the pen.

void GetWidth()

This gets the width of the line the pen will draw.

void SetColor(vColor& c)

You can use this method to set the pen color by passing in a vColor object.

void SetStyle(int style)

This method is used to change the style of a pen. Styles include:

The pen draws a solid line.
The pen is transparent. A transparent pen can be used to avoid drawing borders around shapes. When drawing text, a transparent pen draws the text over the existing background.
The pen draws a dashed line.
The pen draws a dotted line.
The pen draws an alternating dash and dotted line.

void SetWidth(int width)

This sets the width of the line the pen will draw.