FormAnimator class - A helper class that you can add an instance of to a form to provide animation when the form is shown, hidden or closed. Supported animations are Roll (form is unrolled and rolled up from one edge to the opposite), Centre (form unrolls from the centre out and rolls up from all edges in), Slide (form slides in and out from one edge to the opposite) and Blend (form fades in and out). Roll and Slide animations can be up, down, left, right or diagonal. To use this class just add a single line of code similar to this to your form:
VB Code:
Private myAnimator As New FormAnimator(Me, FormAnimator.AnimationMethod.Slide, FormAnimator.AnimationDirection.Up, 400)
ToastForm class - An inherited Form class that uses the FormAnimator class to produce the same "toast" effect used by MSN Messenger and other apps, where the form slides up from the system tray and then slides back again after a period of time. To use this class just add code like this:
VB Code:
Dim myToastForm As New ToastForm(5000, "This is a ""toast"" popup demo.")
myToastForm.Show()
Edit: 30/09/2005
I've updated the ToastForm class so that it now will not receive focus when it is displayed. It will still receive focus if you click on it though.
Edit: 30/09/2005
I've updated the ToastForm class so that existing windows will move up the screen to make way for new ones so that they are not covered.
Edit: 30/09/2005
I've updated the ToastForm class so that it stacks properly if the Height is changed and/or multiple forms are opened with different lifetimes.
Try putting the following code in a form and pressing the button several times in succession to see this in action:
VB Code:
Dim myRandom As New Random
Dim formNumber As Integer = 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim toast As New ToastForm(myRandom.Next(5000, 10000), "This is form number " & Me.formNumber.ToString())
toast.Height = myRandom.Next(150, 300)
toast.Show()
Me.formNumber += 1
End Sub