Пример #1
0
        public override void OnMouseMove(MouseEventArgs e)
        {
            if (isNewObjectAdded == false)
            {
                return;
            }
            Point     point = new Point(e.X, e.Y);
            int       index = CC.FindObjectIndex(CC.ID);
            DrawCurve w     = (DrawCurve)CC.graphicsList[index];

            if (e.Button == MouseButtons.Left)
            {
                int dx       = myLastPoint.X - point.X;
                int dy       = myLastPoint.Y - point.Y;
                int distance = (int)Math.Sqrt(dx * dx + dy * dy);
                if (distance < minDistance)
                {
                    if (w.PointList.Count > 1)
                    {
                        w.MoveHandleTo(point, w.HandleCount);
                    }
                }
                else
                {
                    w.PointList.Add(point);
                    myLastPoint = point;
                }
            }
            CC.panel.Refresh();
        }
Пример #2
0
        public override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            CC.isToolPoint = false;
            CC.ID          = CC.GetNewID();
            Point     p = new Point(e.X, e.Y);
            DrawCurve w = new DrawCurve(p, Color.Red, 2, CC.ID);

            AddNewObject(w);
            myLastPoint      = p;
            isNewObjectAdded = true;
        }
Пример #3
0
        /// <summary>克隆</summary>
        public override DrawObject Clone()
        {
            DrawCurve w = new DrawCurve();

            for (int i = 0; i < this.pointList.Count; i++)
            {
                w.pointList.Add(this.pointList[i]);
            }
            w.PenColor = this.PenColor;
            w.PenWidth = this.PenWidth;
            return(w);
        }