Results 1 to 6 of 6

Thread: Form transparent?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Location
    England
    Posts
    242

    Form transparent?

    how would i set the form transparent? (but i still want to be able to see the forms picture which is a transparent GIF image, i just want the bits of the form i can see to be transparent.
    please give in detail as this need to be done very quickly and im not that advanced in VB.
    cheers
    Lpeek

  2. #2
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    search the forums. This has been asked before.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  3. #3
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    This has been answered many times before, but here ya go anyway.

    VB Code:
    1. Const LWA_COLORKEY = &H1
    2. Const LWA_ALPHA = &H2
    3. Const GWL_EXSTYLE = (-20)
    4. Const WS_EX_LAYERED = &H80000
    5. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    6. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    7. Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    8. Private Sub Form_Load()
    9.     'KPD-Team 2000
    10.     'URL: [url]http://www.allapi.net/[/url]
    11.     'E-Mail: [email][email protected][/email]
    12.     Dim Ret As Long
    13.     'Set the window style to 'Layered'
    14.     Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
    15.     Ret = Ret Or WS_EX_LAYERED
    16.     SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
    17.     'Set the opacity of the layered window to 128
    18.     SetLayeredWindowAttributes Me.hWnd, 0, 128, LWA_ALPHA
    19. End Sub

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Location
    England
    Posts
    242
    thanks but that sets the whole form translucent, how would i set just the form backcolor transparent but still be able to see the forms picture Opaque?
    (the forms backcolor is &H8000000F& if that helps?)
    Lpeek

  5. #5
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    again, search the forum.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  6. #6
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    maybe he has searched the forums. instead of taking time to say someone has a fault, why don't you take that same time and maby give a link to the thread that YOU know exists? Why not give this man a fishing rod instead of shutting the door in his face? It's possible the threads you all have seen arent being pulled by his search methods. I for one don't have all night to search so that's why I take advantage to the reason forums were created: to ask questions.

    My opinion is you shouldn't answer at all if you're not going to help.
    Last edited by Andy; Dec 5th, 2003 at 09:04 PM.

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