Results 1 to 5 of 5

Thread: form shape

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    8
    how can i change the shape of my form to letz say...an oval, instead of having a rectangle?
    i'm doing this in vb4

  2. #2
    Lively Member
    Join Date
    Jul 1999
    Posts
    99
    i don't remember the exact function names but this will give you an idea:

    use: SetWindowRgn, CreateEllipticalRgn & SetWindowPos

    1. Create an elliptical region using CreateEllipticalRgn.
    2. Set the forms region using the created region.
    3. Refresh your form using setwindowpos.

    Sorry, for not giving the complete code. I don't remember my functions.

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Here ya go...

    I don't remember where I got this, but it works...

    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 Sub Form_Load()
        Me.Show 'Show the form
        SetWindowRgn hWnd, CreateEllipticRgn(0, 0, 300, 200), True
    End Sub
    Mess around with the CreateEllipticRgn arguments to change the shape of the form
    ~seaweed

  4. #4
    Lively Member
    Join Date
    Jul 1999
    Posts
    99
    that's it! if you want to create a different shape other than ellipse, you can use other api functions for creating regions. (functions with the 'Rgn' suffixes)

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    8
    i used your code seaweed, but it keeps saying CreateEllipticRgn isnt defined
    do i define as long?
    and when i define as long i get an expected array
    in desparate need! help ! =)

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