当前位置: 首页 > news >正文

WPF里的几何图形Path绘制

Shape类
2、Ellipse
3、Rectangle
4、Line
5、Polyline
6、Polygon


7、Path

名称
LineGeometry       
简单几何 作用类似于Shape中的Line
RectangleGeometry        简单几何作用类似于Shape中的Rectangle
EllipseGeometry    简单几何    作用类似于Shape中的Ellipse
GeometryGroup       用于创建复合几何 为单个路径添加任意多个Geometry对象,使用EvenOdd或NonZero填充规则来确定要填充的区域。
CombinedGeometry    用于创建复合几何    将两个几何图形合并为一个形状。可使用CombineMode属性选择如何组合两个几何图形。
PathGeometry      路径几何  代表更复杂的弧线、曲线以及直线构成的图形,并且既可以是闭合的,也可以是不闭合的。
StreamGeometry      路径几何  相当于PathGeometry的只读轻量级。StreamGeometry图形可节省内存,因为它不在内存中同时保存路径的所有分段。并且这类图形一旦被创建就不能再修改

LineGeometry

<Line X1="10" Y1="10" X2="100" Y2="50" Stroke="Orange" StrokeThickness="4"  StrokeStartLineCap="Round" StrokeEndLineCap="Round"></Line>
<Path Stroke="Green" StrokeStartLineCap="Round" StrokeThickness="4" StrokeEndLineCap="Round"><Path.Data><LineGeometry StartPoint="10,10" EndPoint="100,50"></LineGeometry></Path.Data>
</Path>

EllipseGeometry

RectangGeometry

<Ellipse Height="40" Width="40" Stroke="Orange" StrokeThickness="4" Fill="Green" HorizontalAlignment="Left"></Ellipse>
<Path Stroke="Green" StrokeThickness="4" Fill="Red"><Path.Data><EllipseGeometry Center="20,50" RadiusX="20" RadiusY="20"></EllipseGeometry></Path.Data>
</Path>    

 <Path Fill="Orange"><Path.Data><RectangleGeometry Rect="10 5 100 50"></RectangleGeometry></Path.Data></Path>

ArcGeometry

IsLargeArc,SweepDirection属性介绍

IsLargeArc 为true选择大的那个圆弧,否则选择小的

SweepDirection="Clockwise" 选择顺时针的路线,为CounterClockwise则是逆时针

<Path Stroke="LightGreen" Fill="Red" StrokeThickness="5"><Path.Data><PathGeometry><PathGeometry.Figures><PathFigure StartPoint="50,50"><PathFigure.Segments><ArcSegment Size="100,50" IsLargeArc="False" RotationAngle="0" SweepDirection="Clockwise" Point="50,10" /></PathFigure.Segments></PathFigure></PathGeometry.Figures></PathGeometry></Path.Data>
</Path><Path Stroke="LightGreen" Fill="Red" StrokeThickness="5"><Path.Data><PathGeometry><PathGeometry.Figures><PathFigure StartPoint="50,50"><PathFigure.Segments><ArcSegment Size="100,50" IsLargeArc="True" RotationAngle="0" SweepDirection="Clockwise" Point="50,10" /></PathFigure.Segments></PathFigure></PathGeometry.Figures></PathGeometry></Path.Data>
</Path>
<Path Stroke="LightGreen" Fill="Red" StrokeThickness="5"><Path.Data><PathGeometry><PathGeometry.Figures><PathFigure StartPoint="50,50"><PathFigure.Segments><ArcSegment Size="100,50" IsLargeArc="True" RotationAngle="0" SweepDirection="Counterclockwise" Point="50,10" /></PathFigure.Segments></PathFigure></PathGeometry.Figures></PathGeometry></Path.Data>
</Path>
<Path Stroke="LightGreen" Fill="Red" StrokeThickness="5"><Path.Data><PathGeometry><PathGeometry.Figures><PathFigure StartPoint="50,50"><PathFigure.Segments><ArcSegment Size="100,50" IsLargeArc="False" RotationAngle="0" SweepDirection="Counterclockwise" Point="50,10" /></PathFigure.Segments></PathFigure></PathGeometry.Figures></PathGeometry></Path.Data>
</Path>

RotationAngle 

沿着切口面顺时针旋转,效果如下

这几个属性对以后画 圆环进度条非常有帮助,后面的有空再写

http://www.xdnf.cn/news/1444519.html

相关文章:

  • 硬件驱动C51单片机——裸机(1)
  • 三、Scala方法与函数
  • 【面试场景题】1GB 大小HashMap在put时遇到扩容的过程
  • 安卓系统中IApplicationThread.aidl对应的是哪个类
  • 智慧交通管理信号灯通信4G工业路由器应用
  • 【小白笔记】移动硬盘为什么总比电脑更容易满?
  • 【LeetCode热题100道笔记】括号生成
  • 系统架构设计师备考第14天——业务处理系统(TPS)
  • WebAppClassLoader(Tomcat)和 LaunchedURLClassLoader(Spring Boot)类加载器详解
  • Llama v3 中的低秩自适应 (LoRA)
  • 51单片机-LED与数码管模块
  • 2024 arXiv Cost-Efficient Prompt Engineering for Unsupervised Entity Resolution
  • JetBrains 2025 全家桶 11合1 Windows直装(含 IDEA PyCharm、WebStorm、DataSpell、DataGrip等)
  • Datawhale AI夏令营复盘[特殊字符]:我如何用一个Prompt,在Coze Space上“画”出一个商业级网页?
  • 终于有人把牛客网最火的Java面试八股文整理出来了,在Github上获赞50.6K
  • 使用 PHP Imagick 扩展实现高质量 PDF 转图片功能
  • 特斯拉“宏图计划4.0”发布!马斯克:未来80%价值来自机器人
  • 超适合程序员做知识整理的 AI 网站
  • SQL 函数:使用 REPLACE进行批量文本替换
  • 嵌入式第四十五天(51单片机相关)
  • Windows 电源管理和 Shutdown 命令详解
  • 2025版基于springboot的电影购票管理系统
  • 【Canvas与图标】汽车多彩速度表图标
  • 汽车工装结构件3D扫描尺寸测量公差比对-中科米堆CASAIM
  • 1分钟生成爆款相声对话视频!Coze智能体工作流详细搭建教程,小白也能轻松上手
  • 后端框架(SpringBoot):自动配置的底层执行流程
  • 【开题答辩全过程】以 基于微信小程序的“XIN”学生组织管理系统为例,包含答辩的问题和答案
  • 【题解】Codeforces Round 1046 (Div. 1) A~C
  • 指针高级(2)
  • Spring Boot HTTP状态码详解