Code it while you can. The following may soon be Patent Pending.
private void tmrFader_Tick(object sender, System.EventArgs e)
{
if (m_fadeDir == FadeDirection.In)
{
if (this.Opacity <= 0.99)
{
this.Opacity += 0.1;
}
else
{
this.Opacity = 1;
tmrFader.Enabled = false;
}
}
else if (m_fadeDir == FadeDirection.Out)
{
if (this.Opacity >= 0.2)
{
this.Opacity -= 0.1;
}
else
{
this.Opacity = 0.25;
tmrFader.Enabled = false;
}
}
}
Sigh. I hope it's thrown out on prior art. (/. is on that here.)