Fade-In Form Effect
Makes your VB6 form gradually appear (fade in)
Uses Windows API for transparency control
Great for polishing UI in legacy apps.
Rate Fade-In Form Effect
(0(0 Vote))
Option Explicit
Private Declare Function SetLayeredWindowAttributes Lib "user32" ( _
ByVal hwnd As Long, _
ByVal crKey As Long, _
ByVal bAlpha As Byte, _
ByVal dwFlags As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Const GWL_EXSTYLE = -20
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2
Private Sub Form_Load()
Dim i As Integer
Dim style As Long
' Enable layered window
style = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
SetWindowLong Me.hwnd, GWL_EXSTYLE, style Or WS_EX_LAYERED
' Fade in effect
For i = 0 To 255 Step 5
SetLayeredWindowAttributes Me.hwnd, 0, i, LWA_ALPHA
DoEvents
Sleep 10
Next i
End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Fade-In Form Effect Comments
No comments yet — be the first to post one!
Post a Comment