Dela via


InkDrawingAttributes.Color Property

Definition

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

public:
 property Color Color { Color get(); void set(Color value); };
Color Color();

void Color(Color value);
public Color Color { get; set; }
var color = inkDrawingAttributes.color;
inkDrawingAttributes.color = color;
Public Property Color As Color

Property Value

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

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;

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.

Applies to

See also