Ejemplo n.º 1
0
 /// <summary>
 /// Left mouse button is pressed
 /// </summary>
 /// <param name="drawArea"></param>
 /// <param name="e"></param>
 public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
 {
     // Create new polygon, add it to the list
     // and keep reference to it
     //newPolygon = new DrawPolygon(e.X, e.Y, e.X + 1, e.Y + 1);
     newPolygon = new DrawPolygon();
     AddNewObject(drawArea, newPolygon);
     newPolygon.Shape.Add(new Point(e.X, e.Y));//添加第一个点
     lastX = e.X;
     lastY = e.Y;
 }
Ejemplo n.º 2
0
        //public DrawPolygon(int x1, int y1, int x2, int y2) : base()
        //{
        //    //pointArray = new PointList();
        //    shape.Add(new Point(x1, y1));
        //    shape.Add(new Point(x2, y2));

        //    Initialize();
        //}

        /// <summary>
        /// Clone this instance
        /// </summary>
        public override DrawObject Clone()
        {
            DrawPolygon drawPolygon = new DrawPolygon();

            foreach (Point p in this.shape)
            {
                drawPolygon.shape.Add(p);
            }

            FillDrawObjectFields(drawPolygon);
            return(drawPolygon);
        }
Ejemplo n.º 3
0
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
            newPolygon = null;

            base.OnMouseUp(drawArea, e);
        }