Transitions, Effects for Winforms . NET

Asked

Viewed 792 times

2

How to get the fade-in and out effects, transitions, drives and etc, in forms and their controls in VB.NET, natively or using Frameworks?

1 answer

1

It can be manipulating property Opacity of the form to obtain this effect. Below is a example:

Public Sub fadeIn()
    For fade = 0.0 To 1.1 Step 0.1
        Me.Opacity = fade
        Me.Refresh()
        Threading.Thread.Sleep(100)
    Next
End Sub

Public Sub fadeOut()
    For fade = 90 To 10 Step -10
        Me.Opacity = fade / 100
        Me.Refresh()
        Threading.Thread.Sleep(50)
    Next
End Sub

At the events Form1_Load and Form1_FormClosing you do:

Private Sub Form1_Load(sender As Object, e As EventArgs) 
 Handles MyBase.Load
    fadeIn()
End Sub

Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) 
 Handles MyBase.FormClosing
    fadeOut()
End Sub

Browser other questions tagged

You are not signed in. Login or sign up in order to post.