private void
TickHandler(object sender, EventArgs e)
{
COLORREF
cr=new COLORREF();
cr.Color=Color.White;
_currentTick++;
if(_alpha<255
&& _currentTick<60)
{
//clock
fades in;
_alpha+=32;
if(_alpha>255)
_alpha=255;
Win32Methods.SetLayeredWindowAttributes(
this.Handle, //The handle
to the window
cr,
//the COLORREF for the colour key
(byte)_alpha,(int)LWADefs.LWA_COLORKEY
| (int)LWADefs.LWA_ALPHA);
//The flags to set, both alpha and colour key
}
else
if(_currentTick>60)
{
//clock
fades out
_alpha-=32;
if(_alpha<0)
_alpha=0;
Win32Methods.SetLayeredWindowAttributes(this.Handle,cr,(byte)_alpha,(int)LWADefs.LWA_COLORKEY
| (int)LWADefs.LWA_ALPHA);
if(_alpha==0)
this.Hide();
}
Win32Methods.RedrawWindow(this.Handle,IntPtr.Zero,IntPtr.Zero,(int)RDWDefs.RDW_INVALIDATE
| (int)RDWDefs.RDW_NOERASE | (int)RDWDefs.RDW_INTERNALPAINT);
}