October 15th, 2003, 07:54 AM
Join Date: Aug 2003
Location: Sheffield, UK
Time spent in forums: < 1 sec
Reputation Power: 11
Fading forms into and out of sight
I've been working on the 'bells and whistles' of my project, and im trying to get my main form to fade into and out of sight, on a click on the icon which sits in the system tray.
I've set a timer (FaderTimer) to tick ever 100 miliseconds.
The code is as follows:
Private Sub NotifyIcon1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDown
FaderTimer.Enabled = True
Private Sub FaderTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FaderTimer.Tick
If Me.Opacity >= 1 Then
Do Until Me.Opacity = 0
Me.Opacity = Me.Opacity - 0.1
Do Until Me.Opacity = 1
Me.Opacity = Me.Opacity + 0.1
FaderTimer.Enabled = False
You'd think it would work. However it actually does nothing.
The form initially starts minimised, and no matter how much you click on the system icon, nothing happens.
I've played and tweaked and done all sorts of messing around - i even managed to get the error message to fade in and out!! (just dont ask how!), but cant it to work.
I presume that since the form starts minimised, I need to unminimise it. However the only way I know to do that would be to use Me.Show() -but surely that would bypass the fader completely?