InkDrawingAttributesPencilProperties InkDrawingAttributesPencilProperties InkDrawingAttributesPencilProperties InkDrawingAttributesPencilProperties Class

Definition

Provides a set of static InkDrawingAttributes properties for rendering a pencil stroke on an InkCanvas.

Get an instance of this class by calling InkDrawingAttributes.CreateForPencil and accessing InkDrawingAttributes.PencilProperties.

public : sealed class InkDrawingAttributesPencilProperties : IInkDrawingAttributesPencilPropertiespublic sealed class InkDrawingAttributesPencilProperties : IInkDrawingAttributesPencilPropertiesPublic NotInheritable Class InkDrawingAttributesPencilProperties Implements IInkDrawingAttributesPencilProperties// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Examples

This example demonstrates how to render an ink stroke using pencil attributes.

First, we declare the InkCanvas in XAML.

In the code-behind, we define a SetPencilInkStyle() function to specify the pencil stroke attributes.

<InkCanvas x:Name="inkCanvas"/>

public sealed partial class Sample : Page
{
  public SetPencilInkStyle()
  {
    // Initialize the pencil stroke attributes.
    InkDrawingAttributes pencilAttributes = InkDrawingAttributes.CreateForPencil();
    pencilAttributes.Color = Windows.UI.Colors.Red;
    pencilAttributes.Size = new Windows.Foundation.Size(3, 3);
    Debug.Assert(attributes.Kind == InkDrawingAttributesKind.Pencil);
    pencilAttributes.PencilProperties.Opacity = 0.5f;
    // Update InkPresenter with the pencil attributes.
    inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(pencilAttributes);
  }
} 
<InkCanvas x:Name = "inkCanvas" / >

public sealed partial class Sample : Page
{
  public SetPencilInkStyle()
  {
    // Initialize the pencil stroke attributes.
    InkDrawingAttributes^ pencilAttributes = InkDrawingAttributes::CreateForPencil();
    pencilAttributes->Color = Windows::UI::Colors::Red;
    pencilAttributes->Size = Windows::Foundation::Size(3, 3);
    assert(pencilAttributes->Kind == InkDrawingAttributesKind::Pencil);
    pencilAttributes->PencilProperties->Opacity = 0.5f;
    // Update the InkPresenter with the pencil attributes.
    inkCanvas->InkPresenter->UpdateDefaultDrawingAttributes(pencilAttributes);
  }
} 

Properties

Opacity Opacity Opacity Opacity

Gets or sets the level of transparency used for rendering a pencil stroke on an InkCanvas.

Opacity is a static property of InkDrawingAttributes.

Get an instance of this class by calling InkDrawingAttributes.CreateForPencil and accessing InkDrawingAttributes.PencilProperties.

public : double Opacity { get; set; }public double Opacity { get; set; }Public ReadWrite Property Opacity As double// You can use this property in JavaScript.
Value
double double double double

A value between 0 and 1.0 that specifies the opacity factor, with 1.0 indicating full opacity and 0 indicating transparent. The default value is 0.