InkDrawingAttributes class

InkDrawingAttributes class

Provides properties associated with the drawing of an InkStroke.

Syntax


var inkDrawingAttributes = new Windows.UI.Input.Inking.InkDrawingAttributes();

Members

The InkDrawingAttributes class has these types of members:

Constructors

The InkDrawingAttributes class has these constructors.

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

 

Methods

The InkDrawingAttributes class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

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

 

Properties

The InkDrawingAttributes class has these properties.

PropertyAccess typeDescription

Color

Read/write

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

DrawAsHighlighter

Read/write

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

Read/write

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

Read/write

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

Kind

Read-only

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

PencilProperties

Read-only

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

PenTip

Read/write

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

PenTipTransform

Read/write

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

Size

Read/write

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

 

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.

Note  : This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).
 

Examples

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



var inkManager = new Windows.UI.Input.Inking.InkManager();
var 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.ColorHelper.fromArgb(255, 255, 0, 0); 
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.
 

inkManager.getStrokes().forEach(function (stroke)
{
  var drawingAttributes = stroke.drawingAttributes;
  drawingAttributes.penTip = 
       Windows.UI.Input.Inking.PenTipShape.rectangle;
  stroke.drawingAttributes = drawingAttributes;
}

For the complete example, see Ink App sample.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0 [for Xbox, see UWP features that aren't yet supported on Xbox]

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Input.Inking
Windows::UI::Input::Inking [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

Minimum supported phone

None supported

Namespace

Windows.UI.Input.Inking
Windows::UI::Input::Inking [C++]

Metadata

Windows.winmd

Attributes

[DualApiPartition()]
[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]

See also

Object
Windows.UI.Input.Inking Classes
Pen and stylus interactions
Windows.UI.Input.Inking.InkManager.SetDefaultDrawingAttributes
Windows.UI.Input.Inking.InkStroke.DrawingAttributes
UI.Xaml.Controls.InkToolbar.InkDrawingAttributes
Samples
Ink sample
Simple ink sample
Complex ink sample

 

 

Show:
© 2016 Microsoft