当前位置:网站首页>WPF 截图控件之画笔(八)「仿微信」
WPF 截图控件之画笔(八)「仿微信」
2022-08-04 11:31:00 【yanjinhua】
前言
接着上周写的截图控件继续更新添加 画笔。
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[1] ScreenCut.xaml Gitee[2] ScreenCut Gitee[3] ScreenCut.xaml Gitee[4]

项目地址
框架名:WPFDevelopers 作者:WPFDevelopers GitHub[5] Gitee[6]
参考资料
ScreenCut GitHub: https://github.com/WPFDevelopersOrg/WPFDevelopers/blob/master/src/WPFDevelopers/Controls/ScreenCut/ScreenCut.cs
[2]ScreenCut.xaml Gitee: https://github.com/WPFDevelopersOrg/WPFDevelopers/blob/master/src/WPFDevelopers/Themes/ScreenCut.xaml
[3]ScreenCut Gitee: https://gitee.com/WPFDevelopersOrg/WPFDevelopers/blob/master/src/WPFDevelopers/Controls/ScreenCut/ScreenCut.cs
[4]ScreenCut.xaml Gitee: https://gitee.com/WPFDevelopersOrg/WPFDevelopers/blob/master/src/WPFDevelopers/Themes/ScreenCut.xaml
[5]GitHub:: https://github.com/WPFDevelopersOrg
[6]Gitee:: https://gitee.com/WPFDevelopersOrg
边栏推荐
猜你喜欢
秒云成功入选《2022爱分析 · 银行数字化厂商全景报告》,智能运维能力获认可
Oracle中对临时表空间执行shrink操作
多行函数;group_by分组;having分组后筛选;单表查询总结
Xilinx VIVADO 中 DDR3(Naive)的使用(2)读写设计
The use of DDR3 (Naive) in Xilinx VIVADO (1) to create an IP core
傅里叶级数与傅里叶变换学习
【目标检测】yolov3特征提取网络------Darknet53网络及pytorch实现
Advanced transcriptome analysis and R data visualization hot registration (2022.10)
The use of DDR3 (Naive) in Xilinx VIVADO (2) Read and write design
Leetcode Brush Questions - Path Sum
随机推荐
【LeetCode】98.验证二叉搜索树
秒云成功入选《2022爱分析 · 银行数字化厂商全景报告》,智能运维能力获认可
The use of DDR3 (Naive) in Xilinx VIVADO (3) simulation test
The use of DDR3 (Naive) in Xilinx VIVADO (1) to create an IP core
Implementation principle of function emplace_back in vector
请 AI 画家弄了个 logo,网友热议:画得非常好,下次别画了!
Leetcode刷题——路径总和
光盘刻录步骤
Leetcode——利用先序遍历特性完成114. 二叉树展开为链表
Mysql高级篇学习总结13:多表连接查询语句优化方法(带join语句)
中电金信技术实践|分布式事务简说
ESP8266-Arduino编程实例-APDS-9930环境光和趋近感器驱动
使用函数
你值得拥有的登录注册页面(附赠源码)
网管交换机与非网管交换机如何选择?
[Flight Control Development Advanced Course 7] Crazy Shell Open Source Formation UAV - Formation Flight
小程序实战(一)- 骨架屏的应用与实现
mysqldump远程备份数据库
ESP8266-Arduino编程实例-MQ3酒精传感器驱动
使用.NET简单实现一个Redis的高性能克隆版(二)