santy
Jul 30th, 2001, 06:41 AM
hello,
i have a problem from last long time. the problem is that i want my form to be transparent . for example if i put a picture on my form than only picture should be visible for user. it means i want to change the shape of form or want to show my form in round shape or only a picture.
i hope you will solve my problem.
Many thanks in advance.
santy.
Chris
Jul 31st, 2001, 05:22 AM
I juz wrote this code fews day ago for someone in this forum & sure this is the thhing you looking at... ;)
Option Explicit
'// WIN32API Function
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode 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 SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
'// WIN32API Structure
Private Type POINTAPI
x As Long
y As Long
End Type
'// WIN32API Constant
Private Const WINDING = 2
Private Sub Form_Load()
Load frmSample
frmSample.Show
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload frmSample
End Sub
Private Sub CmdAction_Click(Index As Integer)
Dim hRgn As Long
Dim pt(4) As POINTAPI
Select Case Index
Case 0 '// Ellipse
hRgn = CreateEllipticRgn(0, 0, 200, 400)
Case 1 '// Triangle
pt(0).x = 200
pt(0).y = 0
pt(1).x = 400
pt(1).y = 500
pt(2).x = 0
pt(2).y = 500
pt(3).x = 200
pt(3).y = 0
hRgn = CreatePolygonRgn(pt(0), 4, WINDING)
Case 2 '// Round Rect
hRgn = CreateRoundRectRgn(0, 0, 400, 400, 50, 50)
Case 3 '// Circle
hRgn = CreateEllipticRgn(0, 0, 300, 300)
End Select
SetWindowRgn frmSample.hWnd, hRgn, True
End Sub
regards,
:)