|
-
Aug 13th, 2000, 02:33 PM
#1
Thread Starter
Junior Member
Can anyone tell me how to make a form a bit transparent (translucent) so i can just barely see the form behind it? if anyone can i will be forever grateful
-
Aug 13th, 2000, 05:41 PM
#2
Monday Morning Lunatic
Technically, you can only do this in Win2000, but I think if you controlled the drawing of ALL your window (including the non-client areas), you'd be able to make them semitransparent by mixing them with the current screen image below.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 14th, 2000, 03:25 AM
#3
Thread Starter
Junior Member
well i am running 2000... i just simply have no idea how to do what you said... thanks though
-
Aug 14th, 2000, 03:38 AM
#4
Make your form transparent:
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
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
-
Aug 14th, 2000, 03:47 AM
#5
Thread Starter
Junior Member
do i put that first part in a module or the declarations?
-
Aug 14th, 2000, 03:57 AM
#6
Code:
Module Declarations:
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
Code:
Goes in form:
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
-
Aug 14th, 2000, 04:02 AM
#7
Thread Starter
Junior Member
thanks..
do i need to change any settings on the form? when i try that my form remains but the title bar disappears
-
Aug 14th, 2000, 04:07 AM
#8
Don't have any objects on the form. And no, you shouldn't have to change any settings. Try that code in Form_Activate.
Code:
Private Sub Form_Activate()
SetWindowLong Me.hwnd, GWL_EXSTYLE, _
WS_EX_TRANSPARENT
SetWindowPos Me.hwnd, HWND_NOTOPMOST, _
0&, 0&, 0&, 0&, SWP_SHOWME
End Sub
-
Aug 14th, 2000, 04:24 AM
#9
Thread Starter
Junior Member
thats almost it! io just need it to be translucent... not totally transparent.. arg!
-
Aug 14th, 2000, 05:05 AM
#10
Try:
Code:
Private Sub Form_Activate()
SetWindowLong Me.hwnd, GWL_EXSTYLE, _
WS_EX_TRANSPARENT
SetWindowPos Me.hwnd, HWND_NOTOPMOST, _
0&, 0&, 0&, 0&, SWP_SHOWME
Me.Refresh
End Sub
That will allow you to move the title bar.
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
|