예제 #1
0
        private void CreateArrowSurface(List <Point> locations)
        {
            Point minPoint = GraphDiagram.MinPoint(locations);
            Point maxPoint = GraphDiagram.MaxPoint(locations);

            this.Position = new Point(minPoint.X - 5, minPoint.Y - 5);

            this.segments.Clear();
            for (int i = 0; i < locations.Count - 1; i++)
            {
                if (i == 0)
                {
                    this.segments.Add(new StartSegment(this.initConnector, (Point)locations[i], (Point)locations[i + 1], this.Position));
                }
                else if (i < locations.Count - 2)
                {
                    this.segments.Add(new LineSegment((Point)locations[i], (Point)locations[i + 1], (Point)locations[i - 1], this.Position));
                }
                else
                {
                    this.segments.Add(new EndSegment(this.next, (Point)locations[i], (Point)locations[i + 1], (Point)locations[i - 1], this.Position));
                }
            }

            Size size = new Size(maxPoint.X - minPoint.X + 10, maxPoint.Y - minPoint.Y + 10);

            this.Surface = new Surface(size);
            //the color of transparency is indicated
            this.Transparent      = true;
            this.TransparentColor = GraphDiagram.TRASPARENT_COLOR;
            this.UpdateSurface();
        }
        public void UpdateArrow(List <Point> points, Color arrowColor)
        {
            Point minPoint = GraphDiagram.MinPoint(points);
            Point maxPoint = GraphDiagram.MaxPoint(points);
            Size  size     = new Size(maxPoint.X - minPoint.X + 1, maxPoint.Y - minPoint.Y + 1);

            this.Surface = new Surface(size);
            this.Surface.Fill(GraphDiagram.TRASPARENT_COLOR);
            for (int i = 0; i < (points.Count - 1); i++)
            {
                this.Surface.Draw(new Line(new Point(points[i].X - minPoint.X, points[i].Y - minPoint.Y), new Point(points[i + 1].X - minPoint.X, points[i + 1].Y - minPoint.Y)), arrowColor);
            }
            //The color of transparency is indicated
            this.Transparent      = true;
            this.TransparentColor = GraphDiagram.TRASPARENT_COLOR;
            this.Position         = minPoint;
        }