当前位置:网站首页>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
边栏推荐
- 【黄啊码】MySQL入门—2、使用数据定义语言(DDL)操作数据库
- 知网网站地址更换
- 数据库对象-视图;存储过程
- MySql数据库入门的基本操作
- 强烈推荐一款优秀且通用的后台管理系统
- 怎么禁止textarea拉伸
- Leetcode - using sequence traversal features first completed 114. The binary tree to the list
- Leetcode刷题——二叉搜索树相关题目(98. 验证二叉搜索树、235. 二叉搜索树的最近公共祖先、1038. 从二叉搜索树到更大和树、538. 把二叉搜索树转换为累加树)
- 多行函数;group_by分组;having分组后筛选;单表查询总结
- 知乎数据分析训练营
猜你喜欢

Xilinx VIVADO 中 DDR3(Naive)的使用(2)读写设计

中电金信技术实践|分布式事务简说

【LeetCode】701.二叉搜索树中的插入操作

Oracle中对临时表空间执行shrink操作

职责链模式(responsibilitychain)

Advanced transcriptome analysis and R data visualization hot registration (2022.10)

Leetcode——利用先序遍历特性完成114. 二叉树展开为链表

【目标检测】yolov2特征提取网络------Darknet19结构解析及tensorflow和pytorch实现

God Space - the world's first Web3.0-based art agreement creative platform, broadening the boundaries of multi-art integration

Win11 file types, how to change?Win11 modify the file suffix
随机推荐
剑指长城炮? 长安全新皮卡官方谍照
ECCV 2022 | 清华&腾讯AI Lab提出REALY: 重新思考3D人脸重建的评估方法
【目标检测】yolov3特征提取网络------Darknet53网络及pytorch实现
MySQL不提供数组,只能做成表吗?
你值得拥有的登录注册页面(附赠源码)
Mysql高级篇学习总结14:子查询优化、排序优化、GROUP BY优化、分页查询优化
shell变量
WPF 截图控件之画笔(八)「仿微信」
The use of DDR3 (Naive) in Xilinx VIVADO (1) to create an IP core
Leetcode刷题——路径总和
bitset的基本用法
apache dolphin scheduler 文件dolphinscheduler-daemon.sh详解
Xilinx VIVADO 中 DDR3(Naive)的使用(3)仿真测试
3-5年以上的功能测试如何进阶自动化?
opencv------图片转化为视频
多行函数;group_by分组;having分组后筛选;单表查询总结
Disc burning steps
外键约束;外键约束
POJ1094Sorting It All Out题解
The use of DDR3 (Naive) in Xilinx VIVADO (3) simulation test