Board index » delphi » Changing background colors of components in one routine

Changing background colors of components in one routine

Is it possible to change the color of all components (by example all
buttons) in an application in one routine?
I want in my application that the user is able to redefine the background
colors.

Jan Masselink
j.massel...@hccnet.nl

 

Re:Changing background colors of components in one routine


Quote
> Is it possible to change the color of all components (by example all
> buttons) in an application in one routine?
> I want in my application that the user is able to redefine the background
> colors.

try this:

var i:integer;

for i:=1 to (number of buttons) do
begin
 (findcomponent('Button'+inttostr(i)) as Tbutton).color:=(Tcolor);
end;

Frank Wunderlich
i...@fw-web.de
www.fw-web.de

Re:Changing background colors of components in one routine


A TButton doesn't have a Color property !
If you wanted to change the Color property of all TEdit's on Form1 you would
do something like:

for i := 0 to Form1.ComponentCount - 1 do
  if Form1.Components[i] is TEdit then
    TEdit(Form1.Components[i]).Color := clRed;

"Jan Masselink" <j.massel...@hccnet.nl> schreef in bericht
news:8lc2r8$d9l$1@news.hccnet.nl...

Quote
> Is it possible to change the color of all components (by example all
> buttons) in an application in one routine?
> I want in my application that the user is able to redefine the background
> colors.

> Jan Masselink
> j.massel...@hccnet.nl

Other Threads