如何在UWP中设置墨迹笔划的不透明度?
答案 0 :(得分:0)
您可以设置InkDrawingAttributesPencilProperties Class的不透明度属性以达到目标。
例如:
<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);
}