Results 1 to 4 of 4

Thread: Forms Shapes

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2000
    Location
    Cairo, Egypt
    Posts
    126

    Angry 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.

  2. #2
    Addicted Member
    Join Date
    Aug 2000
    Location
    Croatia
    Posts
    200
    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.

  3. #3
    Addicted Member
    Join Date
    Aug 2000
    Location
    Croatia
    Posts
    200
    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

  4. #4
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    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
  •  



Click Here to Expand Forum to Full Width