'Need 2 pictureboxes (Picture1 & Picture2)
'Set both pictureboxes AutoRedraw to True
'Set both pictureboxes ScaleMode to vbPixels
'Paste the following code in the Decs
Code:Private Const AC_SRC_OVER = &H0 Private Type BLENDFUNCTION BlendOp As Byte BlendFlags As Byte SourceConstantAlpha As Byte AlphaFormat As Byte End Type Private Declare Function AlphaBlend Lib "msimg32.dll" (ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal BLENDFUNCT As Long) As Long Private Declare Sub RtlMoveMemory Lib "kernel32.dll" (Destination As Any, Source As Any, ByVal Length As Long) Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private BF As BLENDFUNCTION, lBF As Long, fade As Byte Private FadeInProgress As Boolean Public Function FadeThePicture(fromPicture As PictureBox, toPicture As PictureBox) If FadeInProgress Then Exit Function For fade = 1 To 60 Step 2 With BF .BlendOp = AC_SRC_OVER .BlendFlags = 0 .SourceConstantAlpha = fade .AlphaFormat = 0 End With RtlMoveMemory lBF, BF, 4 AlphaBlend toPicture.hdc, 0, 0, toPicture.ScaleWidth, toPicture.ScaleHeight, fromPicture.hdc, 0, 0, fromPicture.ScaleWidth, fromPicture.ScaleHeight, lBF toPicture.Refresh Sleep 25 Next fade DoEvents End Function


Reply With Quote
