时间:2016年07月12日 | 作者 : aaronyang | 分类 : WPF | 浏览: 4401次 | 评论 0 人
新建一个窗体Window1
====================www.ayjs.net 杨洋 wpfui.com ayui ay aaronyang=======请不要转载谢谢了。=========
public Window1() { InitializeComponent(); Point arcEndPt = new Point(200, 100); Size arcSize = new Size(75, 75); double rotationAngle = 360; SweepDirection direction = SweepDirection.Clockwise; ArcSegment arcsegment = new ArcSegment(arcEndPt, arcSize, rotationAngle, false, direction, true); PathSegmentCollection pathsegmentCollection = new PathSegmentCollection(); pathsegmentCollection.Add(arcsegment); PathFigure pathFigure = new PathFigure(); pathFigure.StartPoint = new Point(50, 100); pathFigure.Segments = pathsegmentCollection; PathFigureCollection pathFigureCollection = new PathFigureCollection(); pathFigureCollection.Add(pathFigure); PathGeometry pathGeometry = new PathGeometry(); pathGeometry.Figures = pathFigureCollection; Path myPath = new Path(); myPath.Stroke = Brushes.Black; myPath.StrokeThickness = 1; myPath.Data = pathGeometry; myPath.VerticalAlignment = VerticalAlignment.Center; myPath.HorizontalAlignment = HorizontalAlignment.Center; layout.Children.Add(myPath); }
====================www.ayjs.net 杨洋 wpfui.com ayui ay aaronyang=======请不要转载谢谢了。=========
这个知识点,以前AY也是跳过的,感觉有点难理解
RotationAngle
get或set关于X轴旋转的椭圆.(单位degrees).
返回Double类型
关于X轴旋转的椭圆
可以读/写,默认值为"0";
Size
Get/Set 弧所在椭圆的的X-和Y-半径
SweepDirection
Gets或sets 弧是按顺时针方向还是逆时针方向绘制.
返回值是SweepDirection类型.
用一个值来描述弧的绘制方向.
这个属性是read/write.默认值Counterclockwise.
一个ArcSegment关于给定的Size, RotationAngle, start point,和end Point,会有四个不同的弧.
指定IsLargeArc属性可能简化两种弧:一个是从start point到end Point按顺时针方向绘制的和一个是从start point到end Point按逆时针方向绘制的.
IsLargeArc 和 SweepDirection
对于大多数具有特定位置、大小和旋转角度的弧,可以绘制四种不同的弧;IsLargeArc 和 SweepDirection 属性指示要使用哪种弧。
在这四种候选弧扫掠中,两种表示扫掠 180 度或大于 180 度的大弧,另外两种表示扫掠 180 度或小于 180 度的小弧。如果 IsLargeArc 为 true,则选择一种大弧扫掠;
如果为 false,则选择一种小弧扫掠。其余两种候选弧分别以不同方向绘制:Counterclockwise 或 Clockwise。SweepDirection 属性指定要使用哪个方向
xaml的方式画弧
<Grid x:Name="layout"> <Path Stroke="Black" StrokeThickness="1"> <Path.Data> <PathGeometry> <PathGeometry.Figures> <PathFigureCollection> <PathFigure StartPoint="10,100"> <PathFigure.Segments> <PathSegmentCollection> <ArcSegment Size="100,50" RotationAngle="45" IsLargeArc="True" SweepDirection="CounterClockwise" Point="200,100" /> </PathSegmentCollection> </PathFigure.Segments> </PathFigure> </PathFigureCollection> </PathGeometry.Figures> </PathGeometry> </Path.Data> </Path> </Grid>
OK了,现在看懂了
====================www.ayjs.net 杨洋 wpfui.com ayui ay aaronyang=======请不要转载谢谢了。=========
原文参考:http://blog.csdn.net/vevisoft/article/details/4003226
推荐您阅读更多有关于“WPF4.5,”的文章
抖音:wpfui 工作wpf,兴趣学习flutter
目前在合肥市某公司上班,已经厌弃,如果你的公司看的上我,加我QQ私聊
AYUI8全源码 Github地址:前往获取
杨洋(AaronYang简称AY,安徽六安人)和AY交流
高中学历,2010年开始web开发,2015年1月17日开始学习WPF
声明:AYUI7个人与商用免费,源码可购买。部分DEMO不免费
不是从我处购买的ayui7源码,我不提供任何技术服务,如果你举报从哪里买的,我可以帮你转正为我的客户,并送demo
查看捐赠AYUI7.X MVC教程 更新如下:
第一课 第二课 程序加密教程
额 本文暂时没人评论 来添加一个吧
发表评论