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;

}

martes, 3 de noviembre de 2009

TRATAMIENTO FECHAS, RESTAR

DateTime fechaSistema = DateTime.Now.Date;
DateTime d7diasAntes = fechaSistema.AddDays(-7);
DateTime d1mesAntes = fechaSistema.AddMonths(-1);
DateTime d3mesesAntes = fechaSistema.AddMonths(-3);