In my c# windows form application I am trying to draw a rectangle by getting the coordinates from the user through 4 mouse click events in the windows form, one for each point.
Here is what I've tried so far.
private void Form1_Click(object sender, EventArgs e)
{
using (Graphics g = this.CreateGraphics())
{
Pen pen = new Pen(Color.Black, 2);
Brush brush = new SolidBrush(this.BackColor);
g.FillRectangle(brush, this.Bounds); // redraws background
g.DrawRectangle(pen,textBox1.Text,textBox2.Text,textBox3.Text,textBox4.Text);
pen.Dispose();
brush.Dispose();
}
}