Pen::Pen(constBrush*,REAL) method (gdipluspen.h)

Creates a Pen object that uses the attributes of a brush and a real number to set the width of this Pen object.

Syntax

void Pen(
  [in] const Brush *brush,
  [in] REAL        width
);

Parameters

[in] brush

Type: const Brush*

Pointer to a brush to base this pen on.

[in] width

Type: REAL

Optional. Real number that specifies the width of this pen's stroke. The default value is 1.0. If this value is 0, the width in device units is always 1 pixel, except that the width will not be affected by scale-transform operations that are in effect for the Graphics object that the Pen is used for; the width will always be 1 pixel.

Return value

None

Remarks

If you pass the address of a pen to one of the draw methods of a Graphics object, the width of the pen's stroke is dependent on the unit of measure specified in the Graphics object. The default unit of measure is UnitPixel, which is an element of the Unit enumeration.

Examples

The following example creates a Brush object and then creates a Pen object based on the Brush object.

SolidBrush sBrush(Color(255,255,0,0));
Pen pen(&sBrush, 4.0f);

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdipluspen.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Brush

Pen

Pens, Lines, and Rectangles

Setting Pen Width and Alignment