Código:
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(Handle, 0, 255, LWA_ALPHA);
}
void __fastcall TForm2::FormActivate(TObject *Sender)
{
for (int blend = 200; blend < 256; blend+=5)
{
SetLayeredWindowAttributes(Handle, 0, blend, LWA_ALPHA);
Sleep(10);
}
}
void __fastcall TForm2::FormDeactivate(TObject *Sender)
{
for (int blend = 255; blend > 200; blend-=5)
{
SetLayeredWindowAttributes(Handle, 0, blend, LWA_ALPHA);
Sleep(10);
}
}