Easiest question about drawing a rectangle

R

raj

i wanna draw a rectangle on a form and resize it when the window is resized.

help!

i have this

private void Form1_Paint(object sender, PaintEventArgs e)

{

Pen blackPen = new Pen(Color.Red, 4);

Rectangle rect = new Rectangle();

rect = new Rectangle(5, 5, this.Size.Width - 50, this.Size.Height - 50);

e.Graphics.DrawRectangle(blackPen, rect);

}

private void Form1_Resize(object sender, EventArgs e)

{//////////////WHAT GOES HERE?}





thanks
 
J

Jeff Gaines

i wanna draw a rectangle on a form and resize it when the window is
resized.

help!

i have this

private void Form1_Paint(object sender, PaintEventArgs e)

{

Pen blackPen = new Pen(Color.Red, 4);

Rectangle rect = new Rectangle();

rect = new Rectangle(5, 5, this.Size.Width - 50, this.Size.Height - 50);

e.Graphics.DrawRectangle(blackPen, rect);

}

private void Form1_Resize(object sender, EventArgs e)

{//////////////WHAT GOES HERE?}





thanks

How about Form1.Invalidate() ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top