protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     _endPoint = e.Location;
     if (_mouseDown)
     {
         if (DrawStyle == DrawStyle.Line)
         {
             LinePointList.Add(_endPoint);
         }
     }
     base.Invalidate();
 }
        private void DrawTools(Graphics g, Point point)
        {
            switch (DrawStyle)
            {
            case DrawStyle.Rectangle:
                using (Pen pen = new Pen(this.SelectColor))
                {
                    g.DrawRectangle(
                        pen,
                        Rectangle.FromLTRB(
                            _mouseDownPoint.X,
                            _mouseDownPoint.Y,
                            point.X,
                            point.Y));
                }
                break;

            case DrawStyle.Ellipse:
                using (Pen pen = new Pen(this.SelectColor))
                {
                    g.DrawEllipse(
                        pen,
                        Rectangle.FromLTRB(
                            _mouseDownPoint.X,
                            _mouseDownPoint.Y,
                            point.X,
                            point.Y));
                }
                break;

            case DrawStyle.Arrow:
                using (Pen pen = new Pen(this.SelectColor))
                {
                    pen.EndCap       = LineCap.ArrowAnchor;
                    pen.EndCap       = LineCap.Custom;
                    pen.CustomEndCap = new AdjustableArrowCap(4, 4, true);
                    g.DrawLine(pen, _mouseDownPoint, point);
                }
                break;

            case DrawStyle.Text:
                using (Pen pen = new Pen(this.SelectColor))
                {
                    pen.DashStyle   = DashStyle.DashDot;
                    pen.DashCap     = DashCap.Round;
                    pen.DashPattern = new float[] { 9f, 3f, 3f, 3f };

                    g.DrawRectangle(
                        pen,
                        Rectangle.FromLTRB(
                            _mouseDownPoint.X,
                            _mouseDownPoint.Y,
                            point.X,
                            point.Y));
                }
                break;

            case DrawStyle.Line:
                if (LinePointList.Count < 2)
                {
                    return;
                }

                Point[] points = LinePointList.ToArray();

                using (Pen pen = new Pen(this.SelectColor))
                {
                    g.DrawLines(
                        pen,
                        points);
                }
                break;
            }
        }
        private void AddOperate(Point point)
        {
            Color color = this.SelectColor;

            switch (DrawStyle)
            {
            case DrawStyle.Rectangle:
                OperateManager.AddOperate(
                    OperateType.DrawRectangle,
                    color,
                    Rectangle.FromLTRB(
                        _mouseDownPoint.X,
                        _mouseDownPoint.Y,
                        point.X,
                        point.Y));
                break;

            case DrawStyle.Ellipse:
                OperateManager.AddOperate(
                    OperateType.DrawEllipse,
                    color,
                    Rectangle.FromLTRB(
                        _mouseDownPoint.X,
                        _mouseDownPoint.Y,
                        point.X,
                        point.Y));
                break;

            case DrawStyle.Arrow:
                Point[] points = new Point[] { _mouseDownPoint, point };
                OperateManager.AddOperate(
                    OperateType.DrawArrow,
                    color,
                    points);
                break;

            case DrawStyle.Line:
                if (LinePointList.Count < 2)
                {
                    return;
                }
                OperateManager.AddOperate(
                    OperateType.DrawLine,
                    color,
                    LinePointList.ToArray());
                LinePointList.Clear();
                break;

            case DrawStyle.Text:
                EventHandler handler = base.Events[EventTextBoxShow] as EventHandler;
                if (handler != null)
                {
                    handler(this, new EventArgs());
                }
                Rectangle textRect = Rectangle.FromLTRB(
                    _mouseDownPoint.X,
                    _mouseDownPoint.Y,
                    point.X,
                    point.Y);
                DrawTextData textData = new DrawTextData(
                    string.Empty,
                    base.Font,
                    textRect);

                OperateManager.AddOperate(
                    OperateType.DrawText,
                    color,
                    textData);
                break;
            }
        }