This is a little piece of code that will fade the screen, on unload, in one of four different directions. Each time the screen is closed, it will fade in a direction different than the last time it was closed. I use this on my About boxes.
VB Code:
  1. Option Explicit
  2.  
  3. Private Sub FadeScreen(pfForm As Form, pstrWhichWay As String)
  4.        
  5.         Dim sngVertical As Single
  6.         Dim sngHorizontal As Single
  7.         Dim sngMoveToRight As Single
  8.         Dim sngMoveTop As Single
  9.         Dim i As Integer
  10.         Const cnstStep = 1000
  11.        
  12.         sngVertical = pfForm.Width / cnstStep
  13.        
  14.         Select Case UCase(pstrWhichWay)
  15.           Case "TR"
  16.             'fade to top right                '
  17.             sngMoveToRight = pfForm.Height / cnstStep
  18.             sngHorizontal = sngMoveToRight
  19.           Case "BL"
  20.             'fade to bottom left
  21.             sngMoveTop = pfForm.Height / cnstStep
  22.             sngVertical = sngMoveTop
  23.             sngHorizontal = pfForm.Height / cnstStep
  24.           Case "BR"
  25.             'fade to bottom right
  26.             sngMoveTop = pfForm.Height / cnstStep
  27.             sngVertical = sngMoveTop
  28.             sngMoveToRight = pfForm.Height / cnstStep
  29.             sngHorizontal = pfForm.Height / cnstStep
  30.           Case Else
  31.             'default to top left if you put something else in
  32.             sngHorizontal = pfForm.Height / cnstStep 'size of horizontal steps
  33.         End Select
  34.        'save direction to registry
  35.        SaveSetting "FormName", "Unload Screen", "Direction", pstrWhichWay
  36.         For i = 1 To cnstStep - 1
  37.             pfForm.Move pfForm.Left + sngMoveToRight, pfForm.Top + sngMoveTop, _
  38.             pfForm.Width - sngHorizontal, pfForm.Height - sngVertical
  39.         Next
  40.        
  41.         Unload Me
  42.        
  43.     End Sub
  44.  
  45. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  46. Dim strRegSetting As String
  47. Dim strNewDirection As String
  48. strRegSetting = GetSetting("FormName", "Unload Screen", "Direction")
  49.         If strRegSetting = vbNullString Then
  50.            FadeScreen Me, "BR"
  51.            Exit Sub
  52.         Else
  53.           Select Case strRegSetting
  54.             Case "BR"
  55.               strNewDirection = "BL"
  56.             Case "BL"
  57.               strNewDirection = "TR"
  58.             Case "TR"
  59.               strNewDirection = "BR"
  60.           End Select
  61.         End If
  62.         FadeScreen Me, strNewDirection
  63. End Sub