Ejemplo n.º 1
0
 private new void Paint(object sender, PaintEventArgs e)
 {
     if (_startPaint)
     {
         Shapeslist.Accept(new DrawVisitor(), e.Graphics);
         _startPaint = false;
         Refresh();
     }
 }
Ejemplo n.º 2
0
 public Form1()
 {
     InitializeComponent();
     Shapeslist.AddShape(new Circle(new Point(30, 30), 20));
     Shapeslist.AddShape(new Ellipse(new Point(60, 50), 50, 30));
     Shapeslist.AddShape(new Square(new Point(130, 100), 50));
     Shapeslist.AddShape(new Shapes.Rectangle(new Point(200, 100), 20, 80));
     Shapeslist.AddShape(new Segment(new Point(240, 30), new Point(260, 70)));
     Shapeslist.AddShape(new Triangle(new Point(300, 30), new Point(280, 100), new Point(320, 70)));
     foreach (var t in Shapeslist.List)
     {
         listBox1.Items.Add(t.ToString());
     }
     listBox1.Enabled = false;
 }