Results 1 to 4 of 4

Thread: non traditional windows application

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2002
    Location
    Philippines
    Posts
    9

    non traditional windows application

    is anyone knows how to change the window appearance of the application.

    as far as i know, i only knew how to make square or rectangle windows. How could i change its dimesions as circle or anything. . .?

    is vb capable of it?

  2. #2
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    There is an API call, SetWindowRgn that can crop a window to any shape imaginable.
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  3. #3
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    To create the regions for use with SetWindowRgn, use CreateEllipticRgn, CreateRoundRectRgn, CreateRectRgn, CreatePolyRgn and a few more.

    You can combine regions via the CombineRgn function.

    I suggest reading up on "Regions" in MSDN. It'll give you the basics for working with Regions.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Do these help?

    VB Code:
    1. 'round form
    2. 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
    3. Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
    4. Private Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As Long) As Long
    5.  
    6. Private Sub Form_Load()
    7. Dim fwidth As Long, fheight As Long
    8. Dim rval As Long, nhwnd As Long
    9. fwidth = Me.Width / Screen.TwipsPerPixelX
    10. fheight = Me.Height / Screen.TwipsPerPixelY
    11. 'Create Round Rectangular Region
    12. nhwnd = CreateRoundRectRgn(0, 0, fwidth - 25, fheight - 25, fwidth - 50, fheight - 50)
    13. 'Create Elliptic Region
    14. 'nhwnd = CreateRoundRectRgn(0, 0, fwidth - 50, fheight - 50, fwidth - 50, fheight - 50)
    15. 'Set Round Rectangular Region on form
    16. rval = SetWindowRgn(Me.hWnd, nhwnd, True)
    17. rval = DeleteObject(nhwnd)
    18. End Sub
    19.  
    20. 'create a form in the shape of a star
    21. Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
    22. Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
    23.  
    24. Private Type POINTAPI
    25.     X As Long
    26.     Y As Long
    27. End Type
    28.  
    29. Private Function CreatePointStruct(lX As Long, lY As Long) As POINTAPI
    30.     ' Create a point structure
    31.     With CreatePointStruct
    32.         .X = lX
    33.         .Y = lY
    34.     End With
    35. End Function
    36.  
    37. Private Sub Form_Load()
    38. Dim ArrBorder(0 To 9) As POINTAPI
    39.    ' Set all points
    40.    ArrBorder(0) = CreatePointStruct(97, 0)
    41.    ArrBorder(1) = CreatePointStruct(120, 65)
    42.    ArrBorder(2) = CreatePointStruct(193, 65)
    43.    ArrBorder(3) = CreatePointStruct(134, 106)
    44.    ArrBorder(4) = CreatePointStruct(156, 171)
    45.    ArrBorder(5) = CreatePointStruct(97, 131)
    46.    ArrBorder(6) = CreatePointStruct(37, 171)
    47.    ArrBorder(7) = CreatePointStruct(59, 106)
    48.    ArrBorder(8) = CreatePointStruct(0, 65)
    49.    ArrBorder(9) = CreatePointStruct(74, 65)
    50.  
    51.    SetWindowRgn hWnd, CreatePolygonRgn(ArrBorder(0), 10, 1), True
    52. End Sub

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