Window form opacity .. How to control?
in constructor of the form you can write something like this.
this.Opacity = .1;
timer.Interval = new TimeSpan(0, 0, intervalinminutes);
timer.Tick += ChangeOpacity;
timer.Start();
And then define a method like this
void ChangeOpacity(object sender, EventArgs e)
{
this.Opacity += .10; //replace.10 with whatever you want
if(this.Opacity == 1)
timer.Stop();
}
To fade forms in and out, I usually do this:
for(double opacity = 0.0; opacity <= 1.0; opacity += 0.2) {
DateTime start = DateTime.Now;
this.Opacity = opacity;
while(DateTime.Now.Subtract(start).TotalMilliseconds <= 30.0) {
Application.DoEvents();
}
}
It's a nice, simple solution if you'll be doing it very infrequently. Otherwise, I would recommend using threads.