martes, 10 de noviembre de 2009

Fade in & Fade Out para FORMS en C#

using System.Threading;

//CODIGO EN EL FORM_LOAD DE NUESTRO FORMULARIO


public void OpenForm()
{
this.Opacity = 0;
this.Show();
for (float f = 0.0F; f < 1F; f = f + 0.05F)
{
this.Opacity = f;
Thread.Sleep(20);
}
this.Opacity = 1;
}


//CODIGO EN FORM_CLOSING()

public void closingForm()
{
float StepVal = (float)(100f / 5);
float fOpacity = 100f;

for (byte b = 0; b < 5; b++)
{
this.Opacity = fOpacity / 100;
this.Refresh();
fOpacity -= StepVal;

}

No hay comentarios:

Publicar un comentario