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


C# LineSegment.Resize方法代码示例

本文整理汇总了C#中System.Windows.Media.LineSegment.Resize方法的典型用法代码示例。如果您正苦于以下问题:C# LineSegment.Resize方法的具体用法?C# LineSegment.Resize怎么用?C# LineSegment.Resize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.LineSegment的用法示例。


在下文中一共展示了LineSegment.Resize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderUIElements

        public override UIElement[] RenderUIElements()
        {
            UIElement[] uiElements;

            if (!NodeSettings.IsFocused)
            {
                ILineSegment arrowLineSegment = new LineSegment(new Point(NodeUIElementLocation.X + 25, NodeUIElementLocation.Y + 23), new Point(NodeUIElementLocation.X + 130, NodeUIElementLocation.Y + 27));

                Point A = new Point(NodeUIElementLocation.X + 5, NodeUIElementLocation.Y + 5);
                Point B = new Point(NodeUIElementLocation.X + 5, NodeUIElementLocation.Y + 22);
                Point C = new Point(NodeUIElementLocation.X + 5, NodeUIElementLocation.Y + 45);
                Point D = new Point(NodeUIElementLocation.X + 89, NodeUIElementLocation.Y + 45);
                Point E = new Point(NodeUIElementLocation.X + 174, NodeUIElementLocation.Y + 45);
                Point F = new Point(NodeUIElementLocation.X + 174, NodeUIElementLocation.Y + 22);
                Point G = new Point(NodeUIElementLocation.X + 174, NodeUIElementLocation.Y + 5);
                Point H = new Point(NodeUIElementLocation.X + 89, NodeUIElementLocation.Y + 5);

                Point arrowEnd = new Point(NodeSettings.CentreX, NodeSettings.CentreY);

                List<Point> elements = new List<Point>();
                elements.Add(A);
                elements.Add(B);
                elements.Add(C);
                elements.Add(D);
                elements.Add(E);
                elements.Add(F);
                elements.Add(G);
                elements.Add(H);
                Point arrowStart = elements.FindClosestPoint(arrowEnd);

                ILineSegment arrowCoordinates = new LineSegment(arrowStart, arrowEnd);

                Point cornerA = new Point(NodeUIElementLocation.X, NodeUIElementLocation.Y);
                Point cornerB = new Point(NodeUIElementLocation.X + 5, NodeUIElementLocation.Y + 55);
                Point cornerC = new Point(NodeUIElementLocation.X + 179, NodeUIElementLocation.Y + 50);
                Point cornerD = new Point(NodeUIElementLocation.X + 184, NodeUIElementLocation.Y + 5);
                Point triangulationPoint = new Point(NodeUIElementLocation.X + 90, NodeUIElementLocation.Y + 25);

                double mainTopLeftX = NodeSettings.CentreX - 90;
                double mainTopLeftY = NodeSettings.CentreY - 125;

                Point mainCornerA = new Point(mainTopLeftX - 5, mainTopLeftY - 6);
                Point mainCornerB = new Point(mainTopLeftX - 6, mainTopLeftY + 255);
                Point mainCornerC = new Point(mainTopLeftX + 185, mainTopLeftY + 256);
                Point mainCornerD = new Point(mainTopLeftX + 186, mainTopLeftY - 5);
                Point mainTriangulationPoint = new Point(NodeSettings.CentreX, NodeSettings.CentreY);

                IntersectionDetector detector = new IntersectionDetector();
                detector.Add(new LineSegment(cornerA, cornerB, mainTriangulationPoint));
                detector.Add(new LineSegment(cornerB, cornerC, mainTriangulationPoint));
                detector.Add(new LineSegment(cornerC, cornerD, mainTriangulationPoint));
                detector.Add(new LineSegment(cornerD, cornerA, mainTriangulationPoint));

                IntersectionDetector detector2 = new IntersectionDetector();
                detector2.Add(new LineSegment(mainCornerA, mainCornerB, triangulationPoint));
                detector2.Add(new LineSegment(mainCornerB, mainCornerC, triangulationPoint));
                detector2.Add(new LineSegment(mainCornerC, mainCornerD, triangulationPoint));
                detector2.Add(new LineSegment(mainCornerD, mainCornerA, triangulationPoint));

                arrowCoordinates = arrowCoordinates.Resize(detector);
                arrowCoordinates = arrowCoordinates.Resize(detector2);

                Arrow arrow = new Arrow(arrowCoordinates);

                List<UIElement> newElements = new List<UIElement>(base.RenderUIElements());

                newElements.Add(arrow.Sprite);

                uiElements = newElements.ToArray();
            }
            else
            {
                uiElements = base.RenderUIElements();
            }

            return uiElements;
        }
开发者ID:chris-tomich,项目名称:Glyma,代码行数:77,代码来源:CompendiumGenericNode.cs


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