Windows.UI.Input.Inking.InkDrawingAttributes.Color

August 1, 2022 ยท View on GitHub

-description

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

-property-value

The ink color as an ARGB value. The default is black (0, 0, 0, 0).

-remarks

The value of Color is an ARGB value. However, the value of the transparency component (A, or alpha channel) is ignored and the InkStroke is rendered at full opacity.

The value of the transparency component is not discarded. It is stored with all other stroke data in the Ink Serialized Format (ISF) file when the InkStroke is saved.

-examples

The following example demonstrates how to set the Color property (color) of an InkStroke (stroke) using the Windows.UI.ColorHelper.FromArgb method.

var drawingAttributes = stroke.drawingAttributes;
drawingAttributes.color = 
     Windows.UI.ColorHelper.fromArgb(255, 255, 0, 0);
stroke.drawingAttributes = drawingAttributes;

The following alternative demonstrates how to set the Color property (color) of an InkStroke (stroke) without using the Windows.UI.ColorHelper.FromArgb method.

var drawingAttributes = stroke.drawingAttributes;
var color = drawingAttributes.color;
color.a = 255;
color.r = 255;
color.g = 0;
color.b = 0;
drawingAttributes.color = color;
stroke.drawingAttributes = drawingAttributes;

-see-also

Pen and stylus interactions, Get started: Support ink in your UWP app, Ink analysis sample (basic) (C#), Ink handwriting recognition sample (C#), Save and load ink strokes from an Ink Serialized Format (ISF) file, Save and load ink strokes from the clipboard, Ink toolbar location and orientation sample (basic), Ink toolbar location and orientation sample (dynamic), Coloring book sample, Family notes sample, Inking sample (JavaScript), Simple inking sample (C#/C++), Complex inking sample (C++), Ink analysis sample