Results 1 to 3 of 3

Thread: Weird shaped forms

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2001
    Location
    Eldwick, UK
    Posts
    17

    Question Weird shaped forms

    I've seen a wizard that uses the Windows API to make forms that aren't square: no title bar, circular, that sort of thing. Was wondering what the code/API call for it is. And if anyone knows where the wizard is it might save me some time !!!

    Thanks.

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Here is the code

    VB Code:
    1. Option Explicit
    2. '// WIN32API Function
    3. 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
    4. Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
    5. Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
    6. Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
    7.  
    8. '// WIN32API Structure
    9. Private Type POINTAPI
    10.         x As Long
    11.         y As Long
    12. End Type
    13.  
    14. '// WIN32API Constant
    15. Private Const WINDING = 2
    16.  
    17. Private Sub Form_Load()
    18.     Load frmSample
    19.     frmSample.Show
    20. End Sub
    21.  
    22. Private Sub Form_Unload(Cancel As Integer)
    23.     Unload frmSample
    24. End Sub
    25.  
    26. Private Sub CmdAction_Click(Index As Integer)
    27.     Dim hRgn As Long
    28.     Dim pt(4) As POINTAPI
    29.    
    30.     Select Case Index
    31.     Case 0 '// Ellipse
    32.         hRgn = CreateEllipticRgn(0, 0, 200, 400)
    33.     Case 1 '// Triangle
    34.         pt(0).x = 200
    35.         pt(0).y = 0
    36.         pt(1).x = 400
    37.         pt(1).y = 500
    38.         pt(2).x = 0
    39.         pt(2).y = 500
    40.         pt(3).x = 200
    41.         pt(3).y = 0
    42.         hRgn = CreatePolygonRgn(pt(0), 4, WINDING)
    43.     Case 2 '// Round Rect
    44.         hRgn = CreateRoundRectRgn(0, 0, 400, 400, 50, 50)
    45.     Case 3 '// Circle
    46.         hRgn = CreateEllipticRgn(0, 0, 300, 300)
    47.     End Select
    48.    
    49.     SetWindowRgn frmSample.hWnd, hRgn, True
    50. End Sub
    regards,

  3. #3

    Re: Weird shaped forms

    Originally posted by NaiK
    I've seen a wizard that uses the Windows API to make forms that aren't square: no title bar, circular, that sort of thing. Was wondering what the code/API call for it is. And if anyone knows where the wizard is it might save me some time !!!

    Thanks.
    Easier but requires custom control: The PolyForm control at http://www.geocities.com/SiliconValley/Haven/2118

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