How to set the opacity for ink stroke in the UWP?
Asked
Active
Viewed 260 times
1 Answers
0
You could set the opacity property of InkDrawingAttributesPencilProperties Class to achieve your target.
For example:
<InkCanvas x:Name="inkCanvas"></InkCanvas>
public MainPage()
{
this.InitializeComponent();
inkCanvas.InkPresenter.InputDeviceTypes =
Windows.UI.Core.CoreInputDeviceTypes.Mouse |
Windows.UI.Core.CoreInputDeviceTypes.Pen;
InkDrawingAttributes pencilAttributes = InkDrawingAttributes.CreateForPencil();
pencilAttributes.Color = Windows.UI.Colors.Red;
pencilAttributes.Size = new Windows.Foundation.Size(3, 3);
pencilAttributes.PencilProperties.Opacity = 0.5f;
inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(pencilAttributes);
}

Xie Steven
- 8,544
- 1
- 9
- 23