本文整理汇总了C#中System.Windows.Media.ArcSegment.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ArcSegment.SetValue方法的具体用法?C# ArcSegment.SetValue怎么用?C# ArcSegment.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.ArcSegment
的用法示例。
在下文中一共展示了ArcSegment.SetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Control_Loaded
private void Control_Loaded()
{
SyncProperty();
// Draw sector.
_secterPath = new Path();
_secterPath.Fill = new SolidColorBrush(_color);
PathFigure secterPathFigure = new PathFigure();
secterPathFigure.StartPoint = new Point(_innerRadius, 0);
// upper line
LineSegment upperLineSegment = new LineSegment();
upperLineSegment.Point = new Point(_outerRadius, 0);
// right arc
ArcSegment rightArcSegment = new ArcSegment();
rightArcSegment.SetValue(ArcSegment.SizeProperty, new Size(_outerRadius, _outerRadius));
//rightArcSegment.Size.Width = _outerRadius;// = new Point(_outerRadius, _outerRadius);
//rightArcSegment.Size.Height = _outerRadius;
rightArcSegment.RotationAngle = 0;
rightArcSegment.IsLargeArc = Math.Abs(_displayAngle) > 180 ? true : false;
rightArcSegment.SweepDirection = SweepDirection.Clockwise;
rightArcSegment.Point = new Point(Math.Cos(_displayAngle * Math.PI / 180) * _outerRadius, -1 * Math.Sin(_displayAngle * Math.PI / 180) * _outerRadius);
// lower line
LineSegment lowLineSegment = new LineSegment();
lowLineSegment.Point = new Point(Math.Cos(_displayAngle * Math.PI / 180) * _innerRadius, -1 * Math.Sin(_displayAngle * Math.PI / 180) * _innerRadius);
// left arc
ArcSegment leftArcSegment = new ArcSegment();
leftArcSegment.SetValue(ArcSegment.SizeProperty, new Size(_innerRadius, _innerRadius));
//leftArcSegment.Size.Width = _innerRadius;// = new Point(_innerRadius, _innerRadius);
//leftArcSegment.Size.Height = _innerRadius;
leftArcSegment.RotationAngle = 0;
leftArcSegment.IsLargeArc = Math.Abs(_displayAngle) > 180 ? true : false;
leftArcSegment.SweepDirection = SweepDirection.Counterclockwise;
leftArcSegment.Point = new Point(_innerRadius, 0);
// lego!!
secterPathFigure.Segments = new PathSegmentCollection();
secterPathFigure.Segments.Add(upperLineSegment);
secterPathFigure.Segments.Add(rightArcSegment);
secterPathFigure.Segments.Add(lowLineSegment);
secterPathFigure.Segments.Add(leftArcSegment);
PathGeometry secterGeometry = new PathGeometry();
secterGeometry.Figures = new PathFigureCollection();
secterGeometry.Figures.Add(secterPathFigure);
_secterPath.Data = secterGeometry;
_layoutRoot.Children.Add(_secterPath);
// Set rotation
Rotation = _startAngle;
// Math mouse event
if (!_isShadow)
{
_secterPath.MouseEnter += new MouseEventHandler(_secterPath_MouseEnter);
_secterPath.MouseLeave += new MouseEventHandler(_secterPath_MouseLeave);
}
}