user2494051 user2494051 - 1 year ago 110 Question

Adding a transition effect to a winform?

I want to know if there is a way that I can add transition effects to my winforms.

I have about 3 winforms on my application ( that open at the top of the screen. My client is concerned with aesthetics, so transitions is one requirements for the forms to show up when called.

Maybe transition is not accurate. What I mean is having the form move from left to right when called. or top to bottom.

Are there any resources, to help accomplish this?

Answer Source

The simplest way is to use a Timer and increase Opacity in a few steps over a second or two.

An example:


Public Class Form1

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Dim f As Form2
        f = New Form2
        f.Timer1.Enabled = True
        f.Timer1.Interval = 5
        f.Opacity = 0
    End Sub

End Class


Public Class Form2
    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        If Me.Opacity >= 1 Then
            Exit Sub
        End If
        Me.Opacity += 0.05
    End Sub
End Class
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download