how to create rounded form using windows APIs?
Ta
Create rounded form
Re: Create rounded form
Code: Select all
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 Long) As Long
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 DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Form_Load()
Dim lpRect As RECT
Dim W As Long, H As Long
Dim hRgn As Long
' get the bounding rectangle's size
GetWindowRect hWnd, lpRect
W = lpRect.Right - lpRect.Left
H = lpRect.Bottom - lpRect.Top
hRgn = CreateRoundRectRgn(0, 0, W, H, 20, 20)
' trim the window to the region
SetWindowRgn hWnd, hRgn, True
DeleteObject hRgn
End Sub