This document provides instructions for creating a fading window effect in a Visual Basic 2008 Windows Forms application. It involves using two timers - one to gradually increase the window opacity to 1 over multiple timer events, and another to gradually decrease the opacity to 0 so that the window can close smoothly. The key steps are to create a new Windows Forms project, add two timers to the main form, and code the timers to increment/decrement the form's opacity property until the desired opacity is reached. Event handlers are also added to cancel window closing if the fading effect is not yet complete.
1 of 9
More Related Content
03 fade
1. F F F F F
51282792005 . . F F
1
F F Fade
1. Microsoft Visual Basic 2008 F F F
F Microsoft Visual Basic 2008 Express Edition
2. F F F
File>>> New Project ( Ctrl+N F F )
2. F F F F F
51282792005 . . F F
2
3. F (New Project) F
F F New Project F Windows Forms Application
F F Name F fade >>> OK
4. F From1.vb ( Solution Explorer)
3. F F F F F
51282792005 . . F F
3
5.
F form1.vb F F F F F
Toolbox F Components>>> Timer
F Timer1
4. F F F F F
51282792005 . . F F
4
6. Timer F Timer2
7. Timer1 F
1 2 F F
-Option Explicit On F F F
-Option Strict On F F F F
4 - 6 F
5. F F F F F
51282792005 . . F F
5
7-14 Timer1
Me.Opacity = Me.Opacity + 0.1 ' F 0.1
If Me.Opacity < 1 Then ' F F F F F 1 F
Return ' F Timer1 F
Timer1.Enabled = False ' F
8. Timer2 F
16-24 Timer2
Me.Opacity = Me.Opacity - 0.3 ' F F 0.3
If Me.Opacity <> 0 Then ' F F F F 0 F
Return ' F Timer2 F
End If
toClose = True ' F F True
Me.Close() ' 塀 F
6. F F F F F
51282792005 . . F F
6
9. 塀 Form1 (Form1 Events)
FormClosing
7. F F F F F
51282792005 . . F F
7
10. F 塀 Form1
26-32 塀 Form1
If toClose = False Then ' F F False F
e.Cancel = True ' F Cancel F True
Timer2.Enabled = True ' F Timer2
8. F F F F F
51282792005 . . F F
8
F Debug > Star debugging
9. F F F F F
51282792005 . . F F
9
塀 Form1
F F F Form1