Поделиться через


Cursor.DrawingAttributes Property

Cursor.DrawingAttributes Property

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

Definition

Visual Basic .NET Public Property DrawingAttributes As DrawingAttributes
C# public DrawingAttributes DrawingAttributes { get; set; }
Managed C++ public: __property DrawingAttributes* get_DrawingAttributes();
public: __property void set_DrawingAttributes(DrawingAttributes*);

Property Value

Microsoft.Ink.DrawingAttributes. 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.

This property is read/write. This property has no default value.

Exceptions

COMException Leave Site:

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: The DefaultDrawingAttributes property (InkCollector.DefaultDrawingAttributes, InkOverlay.DefaultDrawingAttributes, or InkPicture.DefaultDrawingAttributes) contains 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 null (Nothing in Microsoft® 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 InkPicture.DefaultDrawingAttributes).

Examples

[C#]

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;
                

[VB.NET]

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
                

See Also