Apri un nuovo progetto, nel form aggiungi 2 picturebox, e il codice sotto.
In Picture1 metti la tua immagine, poi avvia il progetto.
Devi 'giocare' sul valore di SourceConstantAlpha (da 0 a 255), esempio:
.SourceConstantAlpha = 10 <- più scuro
.SourceConstantAlpha = 128 <- più chiaro
codice:
Const AC_SRC_OVER = &H00
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
Picture1.ScaleMode = vbPixels
Picture2.ScaleMode = vbPixels
With BF
.BlendOp = AC_SRC_OVER
.BlendFlags = 0
.SourceConstantAlpha = 128
.AlphaFormat = 0
End With
RtlMoveMemory lBF, BF, 4
AlphaBlend Picture2.hdc, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, _
Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, lBF
End Sub
Ciao