C#abe572469

how can get the form coor dinate when resizing the form but still see the image change

i draw a stick diagonaly but

need to put in

Drawline(myPen, point1, point2)

point1=0,0

point2=form.width,form.height

thanks



Re: Visual C# Express Edition resize and form coordinate

C#abe

never mind





Re: Visual C# Express Edition resize and form coordinate

Figo Fei - MSFT

Hi,

Draw the line in the paint event and make it repaint when it is resized:

Code Snippet

private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(new Pen(Color.Black), this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width, this.ClientRectangle.Height);

}

private void Form1_Resize(object sender, EventArgs e)
{
this.Invalidate();
}

Thanks






Re: Visual C# Express Edition resize and form coordinate

C#abe

Figo Fei - MSFT wrote:

Hi,

Draw the line in the paint event and make it repaint when it is resized:

Code Snippet

private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(new Pen(Color.Black), this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width, this.ClientRectangle.Height);

}

private void Form1_Resize(object sender, EventArgs e)
{
this.Invalidate();
}

Thanks

Thanks, although I still need two balls coordinated in the opposite direction together with an animation of the stick for all of them to rotate on the form [the two balls will move up and down when the stick turns around its center, so as not to touch the stick], I think I will try this time by myself.