本文整理匯總了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);
}
}