Hi everybody;
How can I change the forms shape to regullar shapes like circles or ellipse or into irregular shapes like rounded corners and undefined edges.
Printable View
Hi everybody;
How can I change the forms shape to regullar shapes like circles or ellipse or into irregular shapes like rounded corners and undefined edges.
I did this a loooong time ago, but as far as I know it goes something like this...
1. create a region using the CreateEllipticRgn or similar API func.
2. apply that region to a window using the SetWindowRgn API
(set the last parameter - bRedraw - to TRUE)
3. delete the region in the Form_Unload event using the DeleteObject API
Again, this should work, but I'm not sure. Try it.
Yep, it works!
Here's a complete code that will create an elliptic window based on it's size.
Code: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 CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Dim hRgn As Long
Private Sub Form_Load()
ScaleMode = vbPixels
hRgn = CreateEllipticRgn(0, 0, ScaleWidth, ScaleHeight)
Call SetWindowRgn(hWnd, hRgn, True)
Call DeleteObject(hRgn)
End Sub
check out more on your post in API... :)
API Section