eflow
asked on
Form transparency
i have some querstions, hope you don't mind i'm putting it in the same question ;)
1. I want to make a form transparent, but only the form not the picture on the form.
it's because i have used the .picture parameter to insert a background picture, but it's not filling the whole form, there is a spot where the form should be transparent, how ?
2. i have some images there are flickering, because i have made a mouseover effect, and i replace the hover pictures with the originals in form_move, how can i get it stop flickering ? it's so ugly :/
3. i need to get my form minimized when the user uses another program or windows, how do i do that ? i have tried with lost_focus, but it wont work :(
1. I want to make a form transparent, but only the form not the picture on the form.
it's because i have used the .picture parameter to insert a background picture, but it's not filling the whole form, there is a spot where the form should be transparent, how ?
2. i have some images there are flickering, because i have made a mouseover effect, and i replace the hover pictures with the originals in form_move, how can i get it stop flickering ? it's so ugly :/
3. i need to get my form minimized when the user uses another program or windows, how do i do that ? i have tried with lost_focus, but it wont work :(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
the first link was good, another function i will add to my program, but not the one i was looking for :/
the code for focus works fine, thx
the last code doesn't work :/ the images is still flickering, and the program is slower :(
the code for focus works fine, thx
the last code doesn't work :/ the images is still flickering, and the program is slower :(
Answer to question 1
-------------------------- ---------- ---------- ---------- -
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
SetWindowLong Me.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT
SetWindowPos Me.hwnd, HWND_NOTOPMOST, 0&, 0&, 0&, 0&, SWP_SHOWME
Answer to question 2
-------------------------- ---------- ---------- ---------- -
Add a Picture box & make the images as Bitmaps & not Gif/Jpegs or else use the Image Control of the Forms2 controls.
Answer to question 3
-------------------------- ---------- ---------- ---------- -
Try putting the code in the Form_Deactivate event.
--------------------------
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
SetWindowLong Me.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT
SetWindowPos Me.hwnd, HWND_NOTOPMOST, 0&, 0&, 0&, 0&, SWP_SHOWME
Answer to question 2
--------------------------
Add a Picture box & make the images as Bitmaps & not Gif/Jpegs or else use the Image Control of the Forms2 controls.
Answer to question 3
--------------------------
Try putting the code in the Form_Deactivate event.
ASKER
jay, i really want to use jpg/gifs, not bitmaps, can't i make some sort of a workarround ?
and your code for transparency works great, execpt it's not what i'm looking for, it should only make the white color on the form transparent, could you slightly modify it ?
and your code for transparency works great, execpt it's not what i'm looking for, it should only make the white color on the form transparent, could you slightly modify it ?
Hi eflow,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Split points between: vinnyd79 and jayeshshah@idg
eflow, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Split points between: vinnyd79 and jayeshshah@idg
eflow, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Per recommendation split points.
Points reduced from 200 to 100.
This Q awarded to vinnyd79.
jayeshshah@idg,
Points for you here: https://www.experts-exchange.com/questions/20560313/Points-for-jayeshshah-idg-re-20333021.html
Thank you,
RotaredoM
CS Mod @ EE
Points reduced from 200 to 100.
This Q awarded to vinnyd79.
jayeshshah@idg,
Points for you here: https://www.experts-exchange.com/questions/20560313/Points-for-jayeshshah-idg-re-20333021.html
Thank you,
RotaredoM
CS Mod @ EE
Private Declare Function M_GetActiveWindow Lib "user32" _
Alias "GetActiveWindow" () As Long
Function GetActiveWindow() As Long
Dim xHwnd As Long
xHwnd = M_GetActiveWindow()
GetActiveWindow = xHwnd
End Function
Private Sub Timer1_Timer()
If GetActiveWindow <> Me.hWnd Then
If Me.WindowState <> 1 Then
Me.WindowState = 1
End If
End If
End Sub