Beispiel #1
0
 public void AddShape(float x, float y, Color color, SHAPE_TYPE type)
 {
     Shape s = null;
     if (type == SHAPE_TYPE.CIRCLE)
     {
         s = new Circle(x, y, RADIUS, color);
     }
     else if (type == SHAPE_TYPE.SQUARE)
     {
         s = new Square(x, y, RADIUS * 2, RADIUS * 2, color);
     }
     Shapes.Add(s);
 }
Beispiel #2
0
        private void Form1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Shape shape = null;
            if (CurrentType == SHAPE_TYPE.CIRCLE)
            {
                shape = new Circle(e.X, e.Y, SIZE, Brush);

            }
            else if (CurrentType == SHAPE_TYPE.SQUARE)
            {
                shape = new Square(e.X, e.Y, SIZE * 2, SIZE * 2, Brush);
            }
            shapes.Add(shape);
            Invalidate();
        }