'Handle Fade in of form Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)_ Handles MyBase.Load fade_in() End Sub 'Handle Fade Out of form Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing fade_out() End Sub 'Fade in Public Sub fade_in() For FadeIn = 0.0 To 1.1 Step 0.1 Me.Opacity = FadeIn Me.Refresh() Threading.Thread.Sleep(100) Next End Sub 'Fade out: Public Sub fade_out() For FadeOut = 90 To 10 Step -10 Me.Opacity = FadeOut / 100 Me.Refresh() Threading.Thread.Sleep(50) Next End Sub
The programmer's notebook is a reference for programmers. Here you can find code snippet's for VB.Net, C# .Net, WPF and many more...
Pages
Simplest Form Fade effect for VB.net
here's a simple fade effect that you can add to your WinForms application. With this code you'll be able to make a form Fade in on load and fade out on close.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment