Share via


Pen.Pen(const Brush*, REAL) constructor

Applies to: desktop apps only

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

Syntax

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

Parameters

  • brush [in]
    Type: const Brush*

    Pointer to a brush to base this pen on.

  • width [in]
    Type: REAL

    Optional. Real number that specifies the width of this pen's stroke. The default value is 1.0.

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

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdipluspen.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Pen

Pen

Brush

Setting Pen Width and Alignment

Pens, Lines, and Rectangles

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012