المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Zooming picturebox not updating



C# Programming
06-13-2009, 04:13 AM
Hi,

I am trying to create a function that when called takes a pictureBox and make it larger in 5 steps. My problem is that when I run the function the pictureBox is not updated until the last step where the pictureBox is full size.

The picture box is called myPictureBox and has a size of 70,100 at the beginning.


private void button1_Click(object sender, EventArgs e)
{
for (int j = 0; j < 5; j++)
{
zoomOutPicture((j + 1) * 10);
System.Threading.Thread.Sleep(1000);
}
}

private void zoomOutPicture(int zoomF)
{
int myHeight = 100+zoomF;
int myWith = 70 + (int)Math.Round(zoomF * .7, 0);

System.Drawing.Size test;
test = new System.Drawing.Size(myWith, myHeight);
myPictureBox.Size = test;
}



I have spent the last 3 hours searching with out any luck so any help is greatly apriciated.

Thank you.