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