TransParent Control

Reply

Join Date: Jan 2008
Posts: 3
Reputation: bredes is an unknown quantity at this point 
Solved Threads: 0
bredes bredes is offline Offline
Newbie Poster

TransParent Control

 
0
  #1
Jan 23rd, 2008
how to make control transparent like textbox, commandbutton or other.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 645
Reputation: binoj_daniel is an unknown quantity at this point 
Solved Threads: 17
binoj_daniel's Avatar
binoj_daniel binoj_daniel is offline Offline
DaniWeb Expert

Re: TransParent Control

 
0
  #2
Jan 23rd, 2008
Try this code to first create a transparent window:

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 Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2

Private Sub Command1_Click()
Dim f2 As New Form2
f2.show
Call SetWindowLong(f2.hWnd, GWL_EXSTYLE, GetWindowLong(f2.hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED)
Call SetLayeredWindowAttributes(f2.hWnd, 0, 255 / 2, LWA_ALPHA) ' 50% translucent
End Sub

You can modify this code to use for textbox control or command button.
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: TransParent Control

 
1
  #3
Jan 23rd, 2008
hi bredes you post a same thread again.
cek your own post (TransParant Control)
try this thread, its a similiar thread like your post
Control Transparant Form

Ok.
all for the best
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: Jan 2008
Posts: 3
Reputation: bredes is an unknown quantity at this point 
Solved Threads: 0
bredes bredes is offline Offline
Newbie Poster

Re: TransParent Control

 
0
  #4
Jan 23rd, 2008
thanks. for the coding. but i dont want it form transparent . i just want control textbox or commandbutton transparent .

thank for the reply.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 645
Reputation: binoj_daniel is an unknown quantity at this point 
Solved Threads: 17
binoj_daniel's Avatar
binoj_daniel binoj_daniel is offline Offline
DaniWeb Expert

Re: TransParent Control

 
0
  #5
Jan 23rd, 2008
Originally Posted by bredes View Post
thanks. for the coding. but i dont want it form transparent . i just want control textbox or commandbutton transparent .

thank for the reply.
By transparent do you mean it should match the color of the form?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
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