private void button2_Click(object sender, EventArgs e) { _myBitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height); _g = Graphics.FromImage(_myBitmap); Bresenham br = new Bresenham(); Point2D p1 = new Point2D((double)numericUpDown1.Value, (double)numericUpDown2.Value); Point2D p2 = new Point2D((double)numericUpDown3.Value, (double)numericUpDown4.Value); br.DrawLine(_g, p1, p2); pictureBox1.Image = _myBitmap; }