|
-
Feb 13th, 2008, 12:55 PM
#1
Thread Starter
Lively Member
Form Transparency
Hi guys, I'm currently using this to make my form semi-transparent. and it's working fine, for it's meant to be used for.
Code:
Option Explicit
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2
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
Public Function TransForm(Form As Form, TransLevel As Byte) As Boolean
SetWindowLong Form.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes Form.hWnd, 0, TransLevel, LWA_ALPHA
TransForm = Err.LastDllError = 0
End Function
Private Sub Form_Load()
TransForm Me, 200
End Sub
But I now need to be able to control the transparency of the form and the controls separately, rather than all in one. Anyone got any ideas?
Syrillia
-
Feb 14th, 2008, 05:37 AM
#2
Re: Form Transparency
While horrendously inefficient and clunky, if all else fails you could put each control on its own form and control each form's transparency.
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Feb 14th, 2008, 12:40 PM
#3
Lively Member
Re: Form Transparency
Or just have a 'Settings' form available, with frames and a slider calling each forms transparency.
Please use the search function prior to posting a question and see if someone's already answered it.
-If I helped you, please rate me, as I'd do the same for you =)
-Remember to select the Resolved option for your post when you've gotten the answers you need.
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
|