IT评测·应用市场-qidao123.com

标题: WPF 截图控件之画笔(八)「仿微信」 [打印本页]

作者: 一给    时间: 2022-9-16 17:15
标题: WPF 截图控件之画笔(八)「仿微信」
前言

接着上周写的截图控件继续更新添加 画笔
1.WPF实现截屏「仿微信」
2.WPF 实现截屏控件之移动(二)「仿微信」
3.WPF 截图控件之伸缩(三) 「仿微信」
4.WPF 截图控件之绘制方框与椭圆(四) 「仿微信」
5.WPF 截图控件之绘制箭头(五)「仿微信」
6.WPF 截图控件之绘制箭头禁止越界(六)「仿微信」
7.WPF 截图控件之文字(七)「仿微信」
正文

一、接着ScreenCut继续发电;
1)添加画笔操作只允许在可编辑区域内;
  1.   void DrwaInkControl(Point current)
  2.         {
  3.             CheckPoint(current);
  4.             if (current.X >= rect.Left
  5.             &&
  6.             current.X <= rect.Right
  7.             &&
  8.             current.Y >= rect.Top
  9.             &&
  10.             current.Y <= rect.Bottom)
  11.             {
  12.                 if (polyLine == null)
  13.                 {
  14.                     polyLine = new Polyline();
  15.                     polyLine.Stroke = _currentBrush == null ? Brushes.Red : _currentBrush;
  16.                     polyLine.Cursor = Cursors.Hand;
  17.                     polyLine.StrokeThickness = 3;
  18.                     polyLine.StrokeLineJoin = PenLineJoin.Round;
  19.                     polyLine.StrokeStartLineCap = PenLineCap.Round;
  20.                     polyLine.StrokeEndLineCap = PenLineCap.Round;
  21.                     polyLine.MouseLeftButtonDown += (s, e) =>
  22.                     {
  23.                         _radioButtonInk.IsChecked = true;
  24.                         _radioButtonInk_Click(null, null);
  25.                         SelectElement();
  26.                         frameworkElement = s as Polyline;
  27.                         frameworkElement.Opacity = .7;
  28.                     };
  29.                     _canvas.Children.Add(polyLine);
  30.                 }
  31.                 polyLine.Points.Add(current);
  32.             }
  33.                
  34.         }
复制代码
完整代码如下


项目地址


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!




欢迎光临 IT评测·应用市场-qidao123.com (https://dis.qidao123.com/) Powered by Discuz! X3.4