当前位置: 首页>>代码示例>>C#>>正文


C# DrawingContext.DrawArc方法代码示例

本文整理汇总了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));
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:34,代码来源:TargetSymbolAdorner.cs

示例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);
     }
 }
开发者ID:Slowhobo,项目名称:path-of-exile-skilltree-planer,代码行数:23,代码来源:SkillTree-Drawing.cs

示例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);
     }
 }
开发者ID:EmmittJ,项目名称:PoESkillTree,代码行数:33,代码来源:SkillTree-Drawing.cs


注:本文中的System.Windows.Media.DrawingContext.DrawArc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。