【问题标题】:How to set the stroke opacity for InkCanvas pen color?如何设置 InkCanvas 笔颜色的笔触不透明度?
【发布时间】:2018-05-16 16:12:00
【问题描述】:

如何在 UWP 中设置墨迹的不透明度?

【问题讨论】:

    标签: uwp inkcanvas


    【解决方案1】:

    您可以设置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);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-13
      • 2016-01-03
      • 2020-07-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多