public virtual List <ConnectionPoint> GetConnectionPoints()
        {
            List <ConnectionPoint> connectionPoints = new List <ConnectionPoint>();

            if (HasCornerConnections)
            {
                connectionPoints.Add(new ConnectionPoint(GripType.TopLeft, DisplayRectangle.TopLeft()));
                connectionPoints.Add(new ConnectionPoint(GripType.TopRight, DisplayRectangle.TopRight()));
                connectionPoints.Add(new ConnectionPoint(GripType.BottomLeft, DisplayRectangle.BottomLeft()));
                connectionPoints.Add(new ConnectionPoint(GripType.BottomRight, DisplayRectangle.BottomRight()));
            }

            if (HasCenterConnections)
            {
                connectionPoints.Add(new ConnectionPoint(GripType.LeftMiddle, DisplayRectangle.LeftMiddle()));
                connectionPoints.Add(new ConnectionPoint(GripType.RightMiddle, DisplayRectangle.RightMiddle()));
                connectionPoints.Add(new ConnectionPoint(GripType.TopMiddle, DisplayRectangle.TopMiddle()));
                connectionPoints.Add(new ConnectionPoint(GripType.BottomMiddle, DisplayRectangle.BottomMiddle()));
            }

            if (HasLeftRightConnections)
            {
                connectionPoints.Add(new ConnectionPoint(GripType.Start, DisplayRectangle.LeftMiddle()));
                connectionPoints.Add(new ConnectionPoint(GripType.End, DisplayRectangle.RightMiddle()));
            }

            if (HasTopBottomConnections)
            {
                connectionPoints.Add(new ConnectionPoint(GripType.Start, DisplayRectangle.TopMiddle()));
                connectionPoints.Add(new ConnectionPoint(GripType.End, DisplayRectangle.BottomMiddle()));
            }

            return(connectionPoints);
        }
        public virtual List <ShapeAnchor> GetAnchors()
        {
            // draw anchors
            List <ShapeAnchor> anchors = new List <ShapeAnchor>();
            AnchorBox          r;
            int anchorSize = 6;

            if (HasCornerAnchors) // tai cac canh
            {
                Point newPoint = new Point();
                newPoint = DisplayRectangle.TopLeft();
                r        = new AnchorBox(DisplayRectangle.TopLeft(), anchorSize);
                anchors.Add(new ShapeAnchor(ShapeAnchor.GripType.TopLeft, r, Cursors.SizeNWSE));

                newPoint = DisplayRectangle.TopRight();
                newPoint.Offset(-anchorWidthHeight, 0);
                r = new AnchorBox(newPoint, anchorSize);
                anchors.Add(new ShapeAnchor(ShapeAnchor.GripType.TopRight, r, Cursors.SizeNESW));

                newPoint = DisplayRectangle.BottomLeft();
                newPoint.Offset(0, -anchorWidthHeight);
                r = new AnchorBox(newPoint, anchorSize);
                anchors.Add(new ShapeAnchor(ShapeAnchor.GripType.BottomLeft, r, Cursors.SizeNESW));

                newPoint = DisplayRectangle.BottomRight();
                newPoint.Offset(-anchorWidthHeight, -anchorWidthHeight);
                r = new AnchorBox(newPoint, anchorSize);
                anchors.Add(new ShapeAnchor(ShapeAnchor.GripType.BottomRight, r, Cursors.SizeNWSE));
            }

            if (HasCenterAnchors || HasLeftRightAnchors) // tai trai va phai
            {
                Point newPoint = DisplayRectangle.LeftMiddle();
                newPoint.Offset(0, -anchorWidthHeight / 2);
                r = new AnchorBox(newPoint, anchorSize);
                anchors.Add(new ShapeAnchor(ShapeAnchor.GripType.LeftMiddle, r, Cursors.SizeWE));

                newPoint = DisplayRectangle.RightMiddle();
                newPoint.Offset(-anchorWidthHeight, -anchorWidthHeight / 2);
                r = new AnchorBox(newPoint, anchorSize);
                anchors.Add(new ShapeAnchor(ShapeAnchor.GripType.RightMiddle, r, Cursors.SizeWE));
            }

            if (HasCenterAnchors || HasTopBottomAnchors) // tai vi tri tren va duoi
            {
                Point newPoint = new Point();
                newPoint = DisplayRectangle.TopMiddle();
                newPoint.Offset(-anchorWidthHeight / 2, 0);
                r = new AnchorBox(newPoint, anchorSize);
                anchors.Add(new ShapeAnchor(ShapeAnchor.GripType.TopMiddle, r, Cursors.SizeNS));
                newPoint = DisplayRectangle.BottomMiddle();
                newPoint.Offset(-anchorWidthHeight / 2, -anchorWidthHeight);
                r = new AnchorBox(newPoint, anchorSize);
                anchors.Add(new ShapeAnchor(ShapeAnchor.GripType.BottomMiddle, r, Cursors.SizeNS));
            }

            return(anchors);
        }