Hola, proba esto:
Option Explicit
Private Const RGN_XOR = 3
Private Const COLOR_BTNFACE = 15
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
Private Sub OptionTransparente(aCtl As Control, trans As Boolean)
Dim X As Long
Dim Y As Long
Dim wid As Long
Dim hgt As Long
Dim rgnCtl As Long
Dim rgnPixel As Long
Dim colPixel As Long
Dim ctlDC As Long
Dim backColor As Long
backColor = GetSysColor(COLOR_BTNFACE)
wid = aCtl.Width / Screen.TwipsPerPixelX
hgt = aCtl.Height / Screen.TwipsPerPixelY
rgnCtl = CreateRectRgn(0, 0, wid, hgt)
If Not trans Then GoTo TransChkOpt_SetRgn
aCtl.Refresh
ctlDC = GetDC(aCtl.hwnd)
For Y = 0 To hgt
For X = 0 To wid
colPixel = GetPixel(ctlDC, X, Y)
If colPixel = backColor Then
rgnPixel = CreateRectRgn(X, Y, X + 1, Y + 1)
CombineRgn rgnCtl, rgnCtl, rgnPixel, RGN_XOR
DeleteObject rgnPixel
End If
Next X
Next Y
ReleaseDC aCtl.hwnd, ctlDC
TransChkOpt_SetRgn:
DeleteObject SetWindowRgn(aCtl.hwnd, rgnCtl, True)
End Sub
Private Sub Command1_Click()
OptionTransparente Option1, True
End Sub
pone un option arriba de una imagen y apreta el boton.
saludos.