You should be able to make a round form without having to make the form transparent. Just use the CreateEllipticRgn API.
Printable View
You should be able to make a round form without having to make the form transparent. Just use the CreateEllipticRgn API.
Here's a small example.
VB Code:
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 Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long Private hRgn As Long Private Sub Form_Load() hRgn = CreateEllipticRgn(10, 10, 200, 200) SetWindowRgn hWnd, hRgn, True End Sub Private Sub Form_Unload(Cancel As Integer) DeleteObject hRgn End Sub
Here is what I use for round forms (I think they make very cool About boxes).VB Code:
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 SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long Private Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As Long) As Long Private nhwnd As Long Private rval As Long Private Sub Form_Load() Dim fwidth As Long, fheight As Long fwidth = Me.Width / Screen.TwipsPerPixelX fheight = Me.Height / Screen.TwipsPerPixelY 'Create Round Rectangular Region nhwnd = CreateRoundRectRgn(0, 0, fwidth - 25, fheight - 25, fwidth - 50, fheight - 50) 'Set Round Rectangular Region on form rval = SetWindowRgn(Me.hWnd, nhwnd, True) End Sub Private Sub Form_Unload(Cancel As Integer) rval = DeleteObject(nhwnd) End Sub