Results 1 to 2 of 2

Thread: Problem since last long time

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2001
    Location
    india
    Posts
    16

    Problem since last long time

    hello,

    i have a problem from last long time. the problem is that i want my form to be transparent . for example if i put a picture on my form than only picture should be visible for user. it means i want to change the shape of form or want to show my form in round shape or only a picture.

    i hope you will solve my problem.

    Many thanks in advance.

    santy.

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    I juz wrote this code fews day ago for someone in this forum & sure this is the thhing you looking at...

    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,

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