【发布时间】:2018-05-16 16:12:00
【问题描述】:
如何在 UWP 中设置墨迹的不透明度?
【问题讨论】:
如何在 UWP 中设置墨迹的不透明度?
【问题讨论】:
您可以设置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);
}
【讨论】: