how to achieve fade effects like winxp shutdown confirmation window for an application in vb6.
Printable View
how to achieve fade effects like winxp shutdown confirmation window for an application in vb6.
Here is something you can play withvb Code:
'Place this in the declarations section of the Form 'Replace FormName with the Key that you want the registry 'Settings stored under Private Sub FadeScreen(TheForm As Form, WhichWay As String) Dim TheVerticalSize As Single Dim TheHorizontalSize As Single Dim MoveMeToTheRight As Single Dim MoveMyTop As Single Dim i As Integer Const TheStep = 1000 TheVerticalSize = TheForm.Width / TheStep Select Case UCase(WhichWay) Case "TR" 'fade to top right ' MoveMeToTheRight = TheForm.Height / TheStep TheHorizontalSize = MoveMeToTheRight Case "BL" 'fade to bottom left MoveMyTop = TheForm.Height / TheStep TheVerticalSize = MoveMyTop TheHorizontalSize = TheForm.Height / TheStep Case "BR" 'fade to bottom right MoveMyTop = TheForm.Height / TheStep TheVerticalSize = MoveMyTop MoveMeToTheRight = TheForm.Height / TheStep TheHorizontalSize = TheForm.Height / TheStep Case Else 'default to top left if you put something else in TheHorizontalSize = TheForm.Height / TheStep 'size of horizontal steps End Select SaveSetting "FormName", "Unload Screen", "Direction", WhichWay For i = 1 To TheStep - 1 TheForm.Move TheForm.Left + MoveMeToTheRight, TheForm.Top + MoveMyTop, _ TheForm.Width - TheHorizontalSize, TheForm.Height - TheVerticalSize Next Unload Me End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Dim Regsetting As String Dim NewDirection As String Regsetting = GetSetting("FormName", "Unload Screen", "Direction") If Regsetting = "" Then FadeScreen Me, "BR" Exit Sub Else Select Case Regsetting Case "BR" NewDirection = "BL" Case "BL" NewDirection = "TR" Case "TR" NewDirection = "BR" End Select End If FadeScreen Me, NewDirection End Sub