|
-
Jul 27th, 2001, 01:03 PM
#1
Thread Starter
Lively Member
Forms Shapes
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.
-
Jul 27th, 2001, 04:59 PM
#2
Addicted Member
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.
-
Jul 27th, 2001, 05:04 PM
#3
Addicted Member
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
-
Jul 28th, 2001, 10:34 AM
#4
PowerPoster
check out more on your post in API... 
API Section
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|