Delen via


InkDrawingAttributes Class

Definition

Provides properties associated with the drawing of an InkStroke.

public ref class InkDrawingAttributes sealed
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class InkDrawingAttributes final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class InkDrawingAttributes final
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class InkDrawingAttributes
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class InkDrawingAttributes
function InkDrawingAttributes()
Public NotInheritable Class InkDrawingAttributes
Inheritance
Object Platform::Object IInspectable InkDrawingAttributes
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

The following example demonstrates how to set a default drawing attribute for all strokes managed by an InkManager object (inkManager).

// Create the InkManager instance.
Windows.UI.Input.Inking.InkManager inkManager = 
  new Windows.UI.Input.Inking.InkManager();
Windows.UI.Input.Inking.InkDrawingAttributes drawingAttributes = 
  new Windows.UI.Input.Inking.InkDrawingAttributes();
// True is the Default value for fitToCurve.
drawingAttributes.FitToCurve = false;
// Set color to red (default is black).
drawingAttributes.Color = Windows.UI.Colors.CornflowerBlue;
inkManager.SetDefaultDrawingAttributes(drawingAttributes);

The following example demonstrates how to set a drawing attribute for a specific stroke.

Note

You cannot set the DrawingAttributes property of the stroke directly. You must create a copy of the InkDrawingAttributes of the stroke, set the desired values for that InkDrawingAttributes object, and then assign the new InkDrawingAttributes to the DrawingAttributes of the stroke, as shown here.

// Get the InkStroke objects.
IReadOnlyList<InkStroke> inkStrokes = inkManager.GetStrokes();
Windows.UI.Input.Inking.InkStroke cloneStroke = 
  inkStrokes.GetAt(index).Clone();
Windows.UI.Input.Inking.InkDrawingAttributes drawingAttributes = 
  cloneStroke.DrawingAttributes;
drawingAttributes.PenTip = Windows.UI.Input.Inking.PenTipShape.Rectangle;
cloneStroke.DrawingAttributes = drawingAttributes;

Remarks

InkDrawingAttributes can be set globally through the SetDefaultDrawingAttributes method of an InkManager object or an InkStrokeBuilder object. They can also be set on an individual InkStroke object through the DrawingAttributes property.

Version history

Windows version SDK version Value added
1607 14393 CreateForPencil
1607 14393 Kind
1607 14393 PencilProperties
1703 15063 IgnoreTilt
1803 17134 ModelerAttributes

Constructors

InkDrawingAttributes()

Creates a new InkDrawingAttributes object that is used to specify InkStroke attributes.

Properties

Color

Gets or sets a value that indicates the color of an InkStroke.

DrawAsHighlighter

Gets or sets a value that indicates whether the InkStroke is rendered as a highlighter overlay. The stroke is typically set to a bright color, such as yellow.

FitToCurve

Gets or sets a value that indicates whether a Bezier curve or a collection of straight line segments is used to draw an InkStroke.

IgnorePressure

Gets or sets a value that indicates whether the pressure of the contact on the digitizer surface is ignored when you draw an InkStroke.

IgnoreTilt

Gets or sets a value that indicates whether the tilt (tiltx, tilty) of the contact on the digitizer surface is ignored when you draw an InkStroke.

Kind

Gets the InkDrawingAttributes that describe the characteristics of a specific type of InkStroke.

ModelerAttributes

Gets an instance of a ModelerAttributes object for accessing modeler properties of an ink stroke.

PencilProperties

Gets an instance of an InkDrawingAttributesPencilProperties object for setting properties characteristic to a pencil stroke.

PenTip

Gets or sets a value that indicates the shape of the pen tip when you draw an InkStroke.

PenTipTransform

Gets or sets an affine transformation matrix applied to the PenTipShape used for an InkStroke.

Size

Gets or sets a value that indicates the dimensions of the pen tip (PenTip) used to draw an InkStroke.

Methods

CreateForPencil()

Creates an InkDrawingAttributes object for rendering an ink stroke with pencil characteristics.

Applies to

See also