//the method adds a figure to the FigureList class, and draws the desired figure (Line) private void button1_Click(object sender, EventArgs e) { figlist.figarray.Add("Lin"); using (grx = Graphics.FromImage(bmp)) { grx.DrawPolygon(Pens.Black, figlist.GetLine(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text), Convert.ToInt32(textBox4.Text), Convert.ToInt32(textBox3.Text))); } pictureBox1.Image = bmp; }