|
-
Oct 30th, 2002, 01:54 PM
#1
Thread Starter
Frenzied Member
Opaque Form
Does any know how to make a form Opaque or translucent (NOT transparent)?
Beantown Boy
Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
-
Oct 30th, 2002, 02:03 PM
#2
Try this...
VB Code:
Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: [url]http://www.allapi.net/[/url]
Dim Ret As Long
'Set the window style to 'Layered'
Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
'Set the opacity of the layered window to 128
SetLayeredWindowAttributes Me.hWnd, 0, 128, LWA_ALPHA
End Sub
-
Nov 4th, 2002, 07:22 AM
#3
Fanatic Member
How on earth do you find somehting like this out. The only way must be to spend hours reading an api manual.
This is excellent and something I have been looking for for ages.
thanks Hack.
-
Nov 4th, 2002, 09:31 AM
#4
Fanatic Member
Is it possible to make just the form transparent or semi transparent without affecting the controls on it?
-
Nov 4th, 2002, 09:54 AM
#5
Ex-Super Mod'rater
I'mnot perfectly sure bout this but shouldn't you be able to pass the hWnd of the controls in the place of Me.hWnd and set it to the value for normal forms? I can't remember if all controls have a hWnd cos i'm not at my PC with VB on so I can't check but I think they do.
So I couldn't be of anymore help.
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Nov 4th, 2002, 05:21 PM
#6
Frenzied Member
that code didnt work for me...
-
Nov 4th, 2002, 05:22 PM
#7
Frenzied Member
i get the error: "cant find dll entry point SetLayeredWindowAttributes in user32"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|