Počet zobrazení stránky

2011-04-22

Form fade in and out

This code will make fading in and out effect to your form

Public Class Form1

    Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        Do Until Me.Opacity = 0.0
            Me.Opacity -= 0.01
            Me.Refresh()
            System.Threading.Thread.Sleep(10)
        Loop
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Opacity = 0
        Do Until Me.Opacity = 1
            Me.Opacity += 0.01
            Me.Refresh()
            System.Threading.Thread.Sleep(10)
        Loop
    End Sub

End Class 
the values could be changed to make the effect slower or faster

Žádné komentáře:

Okomentovat