Share via


DrawingAttributes Constructor (Pen)

Initializes a new instance of the DrawingAttributes class using the color and width of the specified Pen object.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public Sub New ( _
    pen As Pen _
)
'Usage
Dim pen As Pen 

Dim instance As New DrawingAttributes(pen)
public DrawingAttributes(
    Pen pen
)
public:
DrawingAttributes(
    Pen^ pen
)
public function DrawingAttributes(
    pen : Pen
)

Parameters

Remarks

When modifying drawing attributes for a stroke, try to reuse an existing DrawingAttributes object rather than creating a new one each time. Creating a new DrawingAttributes object allocates memory that remains with the Ink object past the lifetime of the DrawingAttributes object.

Examples

This C# example initializes a new instance of the DrawingAttributes class, theDrawingAttributes, with the Color and Width properties set to those of a pen, thickRedPen.

Pen thickRedPen = new Pen(Color.Red, 200);
DrawingAttributes theDrawingAttributes = new DrawingAttributes(thickRedPen);

This Microsoft Visual Basic .NET example initializes a new instance of the DrawingAttributes class, theDrawingAttributes, with the Width and Width properties set to those of a pen, thickRedPen.

Dim thickRedPen As New Pen(Color.Red, 200)
Dim theDrawingAttributes As New DrawingAttributes(thickRedPen)

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

DrawingAttributes Class

DrawingAttributes Members

DrawingAttributes Overload

Microsoft.Ink Namespace

DrawingAttributes