Control Transparant Form

Thread Solved

Join Date: Nov 2007
Posts: 63
Reputation: Sawamura is an unknown quantity at this point 
Solved Threads: 6
Sawamura's Avatar
Sawamura Sawamura is offline Offline
Junior Poster in Training

Control Transparant Form

 
0
  #1
Jan 9th, 2008
Hi guys/gals,
i need to make transparant form and it can be changing by user. i stuck cause i didn't know how to start..

OK.Best Regards..
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 319
Reputation: DenisOxon is an unknown quantity at this point 
Solved Threads: 15
DenisOxon's Avatar
DenisOxon DenisOxon is offline Offline
Posting Whiz

Re: Control Transparant Form

 
0
  #2
Jan 9th, 2008
Pardon me for asking, why have a form you can't see ?

Denis
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 63
Reputation: Sawamura is an unknown quantity at this point 
Solved Threads: 6
Sawamura's Avatar
Sawamura Sawamura is offline Offline
Junior Poster in Training

Re: Control Transparant Form

 
0
  #3
Jan 10th, 2008
i mean it can be change like opacity
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Control Transparant Form

 
2
  #4
Jan 10th, 2008
you mean the form can be change like opacity.If i right then try this following code :
add this following code to module :
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long,ByVal nIndex As Long) As Long
  2. Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Long,ByVal nIndex As Long,ByVal dwNewLong As Long) As Long
  3. Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long,ByVal nCmdShow As Long) As Long
  4. Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long,ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
  5.  
  6. Private Const GWL_EXSTYLE As Long = -20
  7. Private Const WS_EX_LAYERED As Long = &H80000
  8. Private Const LWA_ALPHA As Long = &H2
  9.  
  10. Public Function Transparant(hwnd As Long, percent As Integer,pil As Boolean)
  11. Dim before as Long
  12. before = GetWindowLong(hwnd,GWL_EXSTYLE)
  13. If pil = true then
  14. before = before Or WS_EX_LAYERED
  15. SetWindowLong hwnd, GWL_EXSTYLE, before
  16. SetLayeredWindowAttributes hwnd, 0, 255 * (percent / 100), LWA_ALPHA
  17. Else
  18. before = before And Not WS_EX_LAYERED
  19. SetWindowLong hwnd, GWL_EXSTYLE, before
  20. End If
  21. End Function

you can call the function like this :
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Transparant Form1.hwnd, val(txtPercent.text), true
you can change text box with other control to get value as percent

Ok. Hope it helps..
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,142
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 531
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: Control Transparant Form

 
0
  #5
Jan 10th, 2008
in .net its so much easier you can use me.opacity
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 63
Reputation: Sawamura is an unknown quantity at this point 
Solved Threads: 6
Sawamura's Avatar
Sawamura Sawamura is offline Offline
Junior Poster in Training

Re: Control Transparant Form

 
0
  #6
Jan 10th, 2008
wow thanks all for excellent reply...
thanks jx_man your code running nice..
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC