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)
添加画笔
操作只允许在可编辑区域内;
再添加
画笔
、使用Polyline来实现;
当前坐标X大于Left 并小于Right允许绘制;
当前坐标Y大于Top并小于Bootom允许绘制;
void DrwaInkControl(Point current)
{
CheckPoint(current);
if (current.X >= rect.Left
&&
current.X <= rect.Right
&&
current.Y >= rect.Top
&&
current.Y <= rect.Bottom)
{
if (polyLine == null)
{
polyLine = new Polyline();
polyLine.Stroke = _currentBrush == null ? Brushes.Red : _currentBrush;
polyLine.Cursor = Cursors.Hand;
polyLine.StrokeThickness = 3;
polyLine.StrokeLineJoin = PenLineJoin.Round;
polyLine.StrokeStartLineCap = PenLineCap.Round;
polyLine.StrokeEndLineCap = PenLineCap.Round;
polyLine.MouseLeftButtonDown += (s, e) =>
{
_radioButtonInk.IsChecked = true;
_radioButtonInk_Click(null, null);
SelectElement();
frameworkElement = s as Polyline;
frameworkElement.Opacity = .7;
};
_canvas.Children.Add(polyLine);
}
polyLine.Points.Add(current);
}
}
复制代码
完整代码如下
ScreenCut GitHub
ScreenCut.xaml Gitee
ScreenCut Gitee
ScreenCut.xaml Gitee
项目地址
框架名:WPFDevelopers
作者:WPFDevelopers
GitHub
Gitee
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
欢迎光临 IT评测·应用市场-qidao123.com (https://dis.qidao123.com/)
Powered by Discuz! X3.4