Results 1 to 3 of 3

Thread: Transparent Forms

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    Post

    Does anyone out there know how to make a form transparent in Vb. The reaason I ask is becauese I would like to have a few command buttons just sit on my desktop without it looking like there is a form, if anyone has any ideas it would be extreamly heapful.

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363

    Post

    Jeremy,

    I copied this from a search in all vb-world, which should work in win95/98, but doesn't in NT.

    1. Code for a module

    Code:
    Public Const GWL_EXSTYLE = (-20)
    Public Const WS_EX_TRANSPARENT = &H20&
    Public Const SWP_FRAMECHANGED = &H20
    Public Const SWP_NOMOVE = &H2
    Public Const SWP_NOSIZE = &H1
    Public Const SWP_SHOWME = SWP_FRAMECHANGED Or _
    SWP_NOMOVE Or SWP_NOSIZE
    Public Const HWND_NOTOPMOST = -2 
    Declare Function SetWindowLong Lib "user32" _
    Alias "SetWindowLongA" _
    (ByVal hwnd As Long, ByVal nIndex As Long, _
    ByVal dwNewLong As Long) As Long
    Declare Function SetWindowPos Lib "user32" _
    (ByVal hwnd As Long, ByVal hWndInsertAfter _
    As Long, ByVal x As Long, ByVal y As Long, _
    ByVal cx As Long, ByVal cy As Long, _
    ByVal wFlags As Long) As Long
    2. Add a commandbutton with following code to Form1

    Code:
    Private Sub Command1_Click()
    SetWindowLong Me.hwnd, GWL_EXSTYLE, _
    WS_EX_TRANSPARENT
    SetWindowPos Me.hwnd, HWND_NOTOPMOST, _
    0&, 0&, 0&, 0&, SWP_SHOWME
    End Sub
    3. The ShowInTaskbar property should be set to False and the BorderStyle to 0-None.


    [This message has been edited by WadeD (edited 02-14-2000).]

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    See this tip

    ------------------
    Marty
    What did the fish say when it hit the concrete wall?
    > > > > > "Dam!"

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