Option Explicit 'This Visual Basic 6.0 illustrates alpha blending. ' 'The project requires two picture boxes called Picture1 and Picture2, ' both with pictures loaded in them. ' 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 Sub Form_Load() Dim BF As BLENDFUNCTION, lBF As Long Picture1.AutoRedraw = True Picture2.AutoRedraw = True 'Set the ScaleMode to vbPixels because API uses pixels Picture1.ScaleMode = vbPixels Picture2.ScaleMode = vbPixels 'set the parameters BF.BlendOp = AC_SRC_OVER BF.BlendFlags = 0 BF.SourceConstantAlpha = 128 BF.AlphaFormat = 0 'copy the BLENDFUNCTION-structure to a Long RtlMoveMemory lBF, BF, 4 'AlphaBlend the picture from Picture1 over the picture of Picture2 AlphaBlend Picture2.hdc, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, lBF End Sub