Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 12-29-2005, 02:42 PM
minervia minervia is offline
Junior Member
 
Join Date: Dec 2005
Posts: 9
Default Transparency Controls?

Hi,is there anyway makes controls transparency?
I know the form can be transparency by setting alphablend
but how to make only on controls?
Reply With Quote
  #2  
Old 12-29-2005, 03:10 PM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: Transparency Controls?

For those components that have a handle (buttons for example) you can use the SetWindowLong function to make them layered and then the SetLayeredWindowAttributes to set transparency:

[link]http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windowclasses/windowclassreference/windowclassfunctions/setwindowlong.asp[/link]
[link]http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setlayeredwindowattributes.asp[/link]

Hope that helps...

gLes
Reply With Quote
  #3  
Old 12-29-2005, 03:31 PM
minervia minervia is offline
Junior Member
 
Join Date: Dec 2005
Posts: 9
Default RE: Transparency Controls?

sorry...i get a little..but still didnt understand of the button handle???
Reply With Quote
  #4  
Old 12-30-2005, 05:57 AM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: Transparency Controls?

Some components like buttons implement windows, which have a handle, which you can use in the API calls to make them transparent, on the other hand Labels don't have a handle, they are just drawn on the the canvas of the form. So if you'd like to make a button transparent you can do it like this:

[delphi]SetWindowLong(Button1.Handle, GWL_EXSTYLE, GetWindowLong(Button1.Handle, GWL_EXSTYLE) or WS_EX_LAYERED);
SetLayeredWindowAttributes(Button1.Handle, 0, TranspValue, LWA_ALPHA);[/delphi]

TranspValue is between 0 and 255.

Hope that helps...

gLes
Reply With Quote
  #5  
Old 12-30-2005, 11:52 AM
minervia minervia is offline
Junior Member
 
Join Date: Dec 2005
Posts: 9
Default RE: Transparency Controls?

thx for the help..but its just not working..the button stat=ys at still...
Reply With Quote
  #6  
Old 12-30-2005, 08:20 PM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: Transparency Controls?

Strange but it's not working for me either, not even on a form Though I know something similar worked for me before...I'll keep looking around in my archives

gLes
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:06 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.