Compartir a través de


Cursor.DrawingAttributes Property

Gets or sets the drawing attributes to apply to ink as it is drawn.

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

Syntax

'Declaration
Public Property DrawingAttributes As DrawingAttributes
'Usage
Dim instance As Cursor
Dim value As DrawingAttributes

value = instance.DrawingAttributes

instance.DrawingAttributes = value
public DrawingAttributes DrawingAttributes { get; set; }
public:
property DrawingAttributes^ DrawingAttributes {
    DrawingAttributes^ get ();
    void set (DrawingAttributes^ value);
}
/** @property */
public DrawingAttributes get_DrawingAttributes ()

/** @property */
public void set_DrawingAttributes (DrawingAttributes value)
public function get DrawingAttributes () : DrawingAttributes

public function set DrawingAttributes (value : DrawingAttributes)
Not applicable.

Property Value

The DrawingAttributes object to apply to ink as it is drawn. If this object is null (Nothing in Microsoft Visual Basic .NET), the cursor uses the default drawing attributes of the ink collector object.

Remarks

The drawing attributes specify the appearance of the stroke. For example, you can specify the width and color of ink.

Successive calls to the DrawingAttributes property change only the drawing attributes of new strokes. They do not apply to strokes that are already collected or being collected.

Note

InkCollector.DefaultDrawingAttributes, InkOverlay.DefaultDrawingAttributes, or Microsoft.Ink.InkPicture.DefaultDrawingAttributes contain the drawing attributes that all cursors use unless they set their own DrawingAttributes property. For example, a new Cursor object on which DrawingAttributes is not set and an old Cursor object on which the DrawingAttributes is set to a null reference (Nothing in Visual Basic) (Nothing in Visual Basic .NET) both use DefaultDrawingAttributes.

A cursor can have different drawing attributes for each ink collector (InkCollector, InkOverlay, or InkPicture) with which it comes in contact. If you do not specify drawing attributes for a cursor, it uses the default drawing attributes of the ink collector. These default attributes are set with the DefaultDrawingAttributes property of the particular ink collector (InkCollector.DefaultDrawingAttributes, InkOverlay.DefaultDrawingAttributes, or Microsoft.Ink.InkPicture. DefaultDrawingAttributes).

Example

This C# example sets some of the default drawing attributes of an InkCollector, theInkCollector.

using Microsoft.Ink;
//. . .
InkCollector theInkCollector = new InkCollector();

// Set the initial Width attribute to thin (30 ink space units)
theInkCollector.DefaultDrawingAttributes.Width = 30;

// Set the initial Color attribute to Black
theInkCollector.DefaultDrawingAttributes.Color = Color.Black;

// Set the initial RasterOperation attribute to CopyPen
theInkCollector.DefaultDrawingAttributes.RasterOperation = RasterOperation.CopyPen;

// Set the initial Transparency attribute to opaque (0)
theInkCollector.DefaultDrawingAttributes.Transparency = 0;

// Set the initial AntiAliased attribute to true
theInkCollector.DefaultDrawingAttributes.AntiAliased = true;

This Visual Basic .NET example sets some of the default drawing attributes of an InkCollector, theInkCollector.

Imports Microsoft.Ink
'. . .
Dim theInkCollector As New InkCollector()

'Set the initial Width attribute to thin (30 ink space units)
theInkCollector.DefaultDrawingAttributes.Width = 30

'Set the initial Color attribute to Black
theInkCollector.DefaultDrawingAttributes.Color = Color.Black

'Set the initial RasterOperation attribute to CopyPen
theInkCollector.DefaultDrawingAttributes.RasterOperation = RasterOperation.CopyPen

'Set the initial Transparency attribute to opaque (0)
theInkCollector.DefaultDrawingAttributes.Transparency = 0

'Set the initial AntiAliased attribute to true
theInkCollector.DefaultDrawingAttributes.AntiAliased = True

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Cursor Class
Cursor Members
Microsoft.Ink Namespace
DrawingAttributes
Stroke.DrawingAttributes
Strokes.ModifyDrawingAttributes