private void button1_Click(object sender, EventArgs e) { IFigureFactory figures = new FigureFactory(); for (int i = 0; i < masPoint.Length; i++) { masPoint[i] = figures.RandFigure(); } // Random r = new Random(); panel1.CreateGraphics().Clear(Control.DefaultBackColor); foreach (var item in masPoint) { DrawFigure.DrawFigureOnControl(panel1, item); } }