示例#1
0
文件: ShapesList.cs 项目: AtanasK/VP
 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);
 }
示例#2
0
文件: Form1.cs 项目: kicoo7/VP
        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();
        }