Easiest question about drawing a rectangle

  • Thread starter Thread starter raj
  • Start date Start date
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
 
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() ?
 
Back
Top