lundi 2 mars 2015

What is the diffrence between two code snippetts

I am trying to create a splash screen form. Its opacity value set to zero. And I have a timer named tmrfadein. Its interval is equal to 5. If I use this code below then it works as expected, the splash form appears gradually.



if (Opacity == 1)
{
tmrfadein.Enabled = false;
}
Opacity += 0.01;


If I use this code .Splash screen appears without waiting



do
{
Opacity += 0.01;
}
while (Opacity <1);
tmrfadein.Enabled = false;


When I debug the code everything looks ok. What is wrong with second one


Aucun commentaire:

Enregistrer un commentaire