本文整理汇总了C#中System.Windows.Media.DrawingContext.DrawArc方法的典型用法代码示例。如果您正苦于以下问题:C# DrawingContext.DrawArc方法的具体用法?C# DrawingContext.DrawArc怎么用?C# DrawingContext.DrawArc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.DrawingContext
的用法示例。
在下文中一共展示了DrawingContext.DrawArc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnRender
protected override void OnRender(DrawingContext dc)
{
var lightBrush = new SolidColorBrush(Colors.LightGray);
var darkBrush = new SolidColorBrush(Colors.Black);
lightBrush.Opacity = 0.4;
darkBrush.Opacity = 0.1;
double t1 = 6; // thickness of dark circle pen
double t2 = 2; // thickness of light pen (circle, arcs, segments)
double d = 0; // distance from light circle to segments
double l = 10; // length of segments
double r = 20.0; // radius of light circle
double r1 = r - (t1 + t2) / 2;
double r2 = r + l;
double r3 = r + t2 / 2 + d;
double r4 = (r + r2) / 2;
var darkPen = new Pen(darkBrush, t1);
var lightPen = new Pen(lightBrush, t2);
dc.DrawEllipse(null, lightPen, Position, r, r);
dc.DrawEllipse(null, darkPen, Position, r1, r1);
dc.DrawArc(null, lightPen, Position, 10, 80, r4, r4);
dc.DrawArc(null, lightPen, Position, 100, 170, r4, r4);
dc.DrawArc(null, lightPen, Position, 190, 260, r4, r4);
dc.DrawArc(null, lightPen, Position, 280, 350, r4, r4);
dc.DrawLine(lightPen, new Point(Position.X, Position.Y - r2), new Point(Position.X, Position.Y - r3));
dc.DrawLine(lightPen, new Point(Position.X, Position.Y + r2), new Point(Position.X, Position.Y + r3));
dc.DrawLine(lightPen, new Point(Position.X - r2, Position.Y), new Point(Position.X - r3, Position.Y));
dc.DrawLine(lightPen, new Point(Position.X + r2, Position.Y), new Point(Position.X + r3, Position.Y));
}
示例2: DrawConnection
private void DrawConnection(DrawingContext dc, Pen pen2, SkillNode n1, SkillNode n2)
{
if (n1.NodeGroup == n2.NodeGroup && n1.orbit == n2.orbit)
{
if (n1.Arc - n2.Arc > 0 && n1.Arc - n2.Arc <= Math.PI ||
n1.Arc - n2.Arc < -Math.PI)
{
dc.DrawArc(null, pen2, n1.Position, n2.Position,
new Size(SkillTree.SkillNode.orbitRadii[n1.orbit],
SkillTree.SkillNode.orbitRadii[n1.orbit]));
}
else
{
dc.DrawArc(null, pen2, n2.Position, n1.Position,
new Size(SkillTree.SkillNode.orbitRadii[n1.orbit],
SkillTree.SkillNode.orbitRadii[n1.orbit]));
}
}
else
{
dc.DrawLine(pen2, n1.Position, n2.Position);
}
}
示例3: DrawConnection
private static void DrawConnection(DrawingContext dc, Pen pen2, SkillNode n1, SkillNode n2)
{
if (!n1.VisibleNeighbors.Contains(n2) || !n2.VisibleNeighbors.Contains(n1)) return;
if (n1.SkillNodeGroup == n2.SkillNodeGroup && n1.Orbit == n2.Orbit)
{
if (n1.Arc - n2.Arc > 0 && n1.Arc - n2.Arc <= Math.PI ||
n1.Arc - n2.Arc < -Math.PI)
{
dc.DrawArc(null, pen2, n1.Position, n2.Position,
new Size(SkillNode.OrbitRadii[n1.Orbit],
SkillNode.OrbitRadii[n1.Orbit]));
}
else
{
dc.DrawArc(null, pen2, n2.Position, n1.Position,
new Size(SkillNode.OrbitRadii[n1.Orbit],
SkillNode.OrbitRadii[n1.Orbit]));
}
}
else
{
var draw = true;
foreach (var attibute in n1.attributes)
{
if (AscendantClassStartRegex.IsMatch(attibute))
draw = false;
}
if (n1.Type == NodeType.Mastery || n2.Type == NodeType.Mastery)
draw = false;
if (draw)
dc.DrawLine(pen2, n1.Position, n2.Position);
}
}