Esempio n. 1
0
 //鼠标按下时触发的事件
 public override void OnMouseDown(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         CC.ID = CC.GetNewID();
         DrawImage w = new DrawImage(e.X, e.Y, 10, 10, CC.bitmap, CC.ID);
         this.AddNewObject(w);
         this.isNewObjectAdded = true;
     }
 }
Esempio n. 2
0
 public override void OnMouseDown(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         CC.ID = CC.GetNewID();
         DrawRectangle w = new DrawRectangle(e.X, e.Y, 1, 1, Color.Red, CC.ID);
         this.AddNewObject(w);
         this.isNewObjectAdded = true;
     }
 }
Esempio n. 3
0
 public override void OnMouseDown(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         this.isNewObjectAdded = true;
         CC.ID = CC.GetNewID();
         DrawText w = new DrawText(e.X, e.Y, CC.strText, CC.color, CC.ID);
         this.AddNewObject(w);
         CC.panel.Refresh();
     }
 }
Esempio n. 4
0
 public override void OnMouseDown(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         CC.ID = CC.GetNewID();
         Point     p = new Point(e.X, e.Y);
         DrawCurve w = new DrawCurve(p, Color.Red, 2, CC.ID);
         this.AddNewObject(w);
         myLastPoint           = p;
         this.isNewObjectAdded = true;
     }
 }
Esempio n. 5
0
 public override void OnMouseMove(MouseEventArgs e)
 {
     if (this.isNewObjectAdded == false)
     {
         return;
     }
     if (e.Button == MouseButtons.Left)
     {
         int           index = CC.FindObjectIndex(CC.ID);
         DrawRectangle w     = (DrawRectangle)CC.graphicsList[index];
         int           x     = w.objRectangle.X;
         int           y     = w.objRectangle.Y;
         Rectangle     rect  = new Rectangle(x, y, e.X - x, e.Y - y);
         w.objRectangle = rect;
     }
     CC.panel.Refresh();
 }
Esempio n. 6
0
        public override void OnMouseMove(MouseEventArgs e)
        {
            if (this.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)
                {
                    w.PointList.Add(point);
                    myLastPoint = point;
                }
            }
            CC.panel.Refresh();
        }
Esempio n. 7
0
        public override void OnMouseMove(MouseEventArgs e)
        {
            if (this.isNewObjectAdded == false)
            {
                return;
            }
            int      index = CC.FindObjectIndex(CC.ID);
            DrawText w     = (DrawText)CC.graphicsList[index];

            if (e.Button == MouseButtons.Left)
            {
                Point point    = new Point(e.X, e.Y);
                float distance = CC.GetDistance(w.startPoint, point) - w.text.Length;
                int   height   = (int)(distance / w.text.Length);
                if (height > 0)
                {
                    w.fontHeight = height;
                    w.endPoint   = point;
                    w.angle      = (float)(Math.Atan2(w.endPoint.Y - w.startPoint.Y, w.endPoint.X - w.startPoint.X) * 180.0 / Math.PI);
                }
            }
            CC.panel.Refresh();
        }