Sep 1, 2010

C# window Form Resize Animation

အခု article ေလးကေတာ့ window form size change တာကုိ တျဖည္းျဖည္းနဲ႔ ေျပာင္းသြားေအာင္ လုပ္တဲ့ animation အေသးစားေလးပါပဲ ။ Programming အေျခခံလုိ႔လဲ ေျပာလုိ႔ ရပါတယ္။
Changing Form Dimensions
ဆုိၾကပါစုိ႔ ။ မူရင္း Default size ကေနျပီးပဲ change လုိက္ရေအာင္. အရင္ဆံုး button ၂ ခုကုိ ထည့္ပါမယ္။ Text property မွာ တစ္ခုကုိ big form size ဆိုျပီးေပးမယ္ ေနာက္တစ္ခုကုိ small form size ဆုိျပီးေပးမယ္။ small form size ဆုိတဲ့ button ရဲ့ click_event မွာ ေအာက္ကကုတ္ေလးထည့္ေပးလုိက္ပါ။


while (this.Width < 200)
{
this.Width--;
Application.DoEvents(); //allow the Form to display its new size before
//the next iteration
}

while (this.Height < 200)
{
this.Height--;
Application.DoEvents();
}


ေနာက္ big form size ဆုိတဲ့ button click_event မွာ ေအာက္က ကုတ္ကုိထည့္ေပးလုိက္ပါ။

while (this.Width > 400)
{
this.Width++;
Application.DoEvents(); //allow the Form to display its new size before
//the next iteration
}

while (this.Height > 400)
{
this.Height++;
Application.DoEvents();
}

ဒါဆုိရင္ သူဟာ form size ခ်ိန္းတာကုိ တျဖည္းျဖည္းနဲ႔ ခ်ိန္းသြားပါလိမ့္မယ္။ ပုိျပီးၾကည့္ေကာင္းသြားပါလိမ့္မယ္။

More info => http://www.vcskicks.com/size-transform.php