//the method adds a figure to the FigureList class, and draws the desired figure (Square) private void button3_Click(object sender, EventArgs e) { figlist.figarray.Add("Squ"); using (grx = Graphics.FromImage(bmp)) { grx.DrawRectangle(Pens.Black, figlist.GetSquare(Convert.ToInt32(textBox12.Text), Convert.ToInt32(textBox11.Text), Convert.ToInt32(textBox10.Text), Convert.ToInt32(textBox9.Text))); } pictureBox1.Image = bmp; }