como hacer formas con transparencias

roer
19 de Noviembre del 2002
necesito hacer fomas que no sean cuadradas de la foma que yo quiera como una flecha un corazon etc alguien podria ayudarme yo se otros trucos que les puedan servir

Nanyin
19 de Noviembre del 2002
Ya intentaste con la API "BitBlt"???, solo que no estoy seguro de que pueda verse el fondo del escritorio, creo que tendrias que usar un fondo negro!!!

webJose
19 de Noviembre del 2002
La "transparencia" se logra creando una region y luego asignando la misma como la region de la ventana usando la función API SetWindowRgn(). Por ejemplo, para hacer que un formulario sea una elipse con una "ventana" rectangular en el centro, usted podría hacer algo como esto:

Option Explicit

Private Const RGN_XOR As Long = 3

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

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 CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) 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 CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long

Private Sub Form_Load()

Dim rc As RECT
Dim hRgnF As Long
Dim hRgnE As Long
Dim hRgnR As Long

Dim lAncho As Long
Dim lAlto As Long

GetWindowRect Me.hwnd, rc
With rc
lAlto = (.Bottom - .Top)
lAncho = (.Right - .Left)
.Left = 0
.Right = lAncho
.Top = 0
.Bottom = lAlto
hRgnE = CreateEllipticRgn(.Left, .Top, .Right, .Bottom)
.Left = (.Left + lAncho) / 2 - lAncho * 0.05
.Right = .Left + lAncho * 0.1
.Top = (.Top + lAlto) / 2 - lAlto * 0.05
.Bottom = .Top + lAlto * 0.1
hRgnR = CreateRectRgn(.Left, .Top, .Right, .Bottom)
End With
hRgnF = CreateRectRgn(0, 0, 0, 0)
CombineRgn hRgnF, hRgnE, hRgnR, RGN_XOR
SetWindowRgn Me.hwnd, hRgnF, True
DeleteObject hRgnF
DeleteObject hRgnE
DeleteObject hRgnR
End Sub