Results 1 to 5 of 5

Thread: Round Form

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2000
    Posts
    45

    Question

    Hi All,
    How can I make a round form?

    I’m using VB6 SP3

    Shaykan
    VBmaster

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Mark
    -------------------

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2000
    Posts
    45

    Didn't Work

    I have all the time errors
    Can you send me small code sample for “round Form”?
    I will appreciate it very match.

    Thanks

    Shaykan
    VBmaster

  4. #4
    Guest
    I've rounded the corners on my form using this code..

    Declare this lot:
    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" (ByVal hObject As Long) As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Declare Function ReleaseCapture Lib "user32" () As Long
    Paste these into your form, the first one's for allowing the form to be moved by clicking anywhere on its surface, and the second you need to delete your shaped form region when the form unloads.

    Code:
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        ReleaseCapture
        SendMessage Me.hWnd, &HA1, 2, 0&
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        DeleteObject ResultRegion
    End Sub
    This last bit is setting the region, yDim and xDim are the pixels sizes of your form and rDim is the radius of your rounded corner.

    Code:
    Private Sub Form_Load()
        Dim nRet As Long
        nRet = SetWindowRgn(Me.hWnd, CreateRoundRectRgn(0, 0, xDim, yDim, 18, 18), True)
    End Sub
    This is just for 'rounded' forms of course, if you want to learn about the others then you'll have to read a tutorial or something...

    Mafro

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2000
    Posts
    45

    Talking Thank you very much

    It is very good.
    Have a nice day.

    shaykan
    VBmaster

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