![]() |
Re: Alle Komponenten einer Application ändern
Sicherheitshalber auch noch nach Label schauen:
Delphi-Quellcode:
for I := 0 to Application.ComponentCount-1 do
begin if Application.Components(I) is TForm then begin for i2 := 0 to TForm(Application.Components(I)).ComponentCount -1 do if TForm(Application.Components(I)).Components[i2] is TLabel then // <-- hier TLabel(TForm(Application.Components(I)).Components[i2]).Font.Color := clRed; end; end; |
Re: Alle Komponenten einer Application ändern
Hallo,
danke der Code funct jetzt bei Formularen. Nun benutze ich auch Frames und habe das hier geändert aber es geht nicht :-( wieso?
Delphi-Quellcode:
if Application.Components[I] is TFrame then
begin for i2 := 0 to TFrame(Application.Components[I]).ComponentCount -1 do if TFrame(Application.Components[I]).Components[i2] is TLabel then // <-- hier TLabel(TFrame(Application.Components[I]).Components[i2]).Font.Color := clRed; end; |
Re: Alle Komponenten einer Application ändern
Guten Morgen.
Zuerst kapselt man die benötigte Funktionalität:
Delphi-Quellcode:
Dann wählt man einen geeigneten Zeitpunkt um sie abzurufen:
// uses TypInfo;
procedure SetProperty(c: TComponent; cClass, cName: String; cValue: Variant); var i: Integer; ppi: PPropInfo; begin if SameText(c.ClassName, cClass) then begin ppi := GetPropInfo(c, cName); if Assigned(ppi) then SetPropValue(c, cName, cValue); end; for i := 0 to Pred(c.ComponentCount) do SetProperty(c.Components[i], cClass, cName, cValue); end;
Delphi-Quellcode:
Grüße vom marabu
SetProperty(Application, 'TLabel', 'Color', clRed);
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:17 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz