当前位置:   article > 正文

WPF中设置inkCanvas的笔刷等属性_wpf inkcanvas

wpf inkcanvas

如果只是简单设置可以直接使用属性:

this.inkCanvas.DefaultDrawingAttributes.Width = 10;
this.inkCanvas.DefaultDrawingAttributes.Height = 10;
  • 1
  • 2

上面的表示画刷的宽度和高度为10,不过简易使用DrawingAttributes

drawingAttributes = new DrawingAttributes(); //简易放到属性上
drawingAttributes.Width = 10;
drawingAttributes.Height = 10;
this.inkCanvas.DefaultDrawingAttributes = drawingAttributes;
  • 1
  • 2
  • 3
  • 4

设置画笔颜色:

drawingAttributes.Color = Colors.Red
//要是不生效加一句话
//this.inkCanvas.DefaultDrawingAttributes = this.drawingAttributes;
  • 1
  • 2
  • 3

设置橡皮擦模式:

this.inkCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
  • 1

设置画笔模式:

this.inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
  • 1

清空画板:

this.inkCanvas.Strokes.Clear();
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/191462
推荐阅读
相关标签
  

闽ICP备14008679号