Autor Beitrag
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Mi 16.03.05 09:34 
Hallo,
gibt es eine möglichkeit bei allen komponenten die Color und font eigenschaft zu ändern ? und gibs eine möglichkeit das nur bei ausgewählten zu tuen(brauche beides, weil ich möchte bei meinem Mediaplaye die möglichkeit haben schnell und einfach grafische komponenten zu ändern).

_________________
MFG
Michael Springwald, "kann kein englisch...."
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Mi 16.03.05 09:48 
Alle Komponenten mit FindComponent abklappern. Falls du zusätzliche Infos für die Komponenten hinterlegen musst, um zu entscheiden bei wem ja und bei wem nein, kannst du die Property Tag verwenden.
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Mi 16.03.05 19:15 
ich habs so gelöst:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
uses
  TypInfo;

procedure TForm1.SetAllFontColor(ANewColor: TColor);
var
  i: Integer;
  Component: TComponent;
begin
  for i := 0 to ComponentCount - 1 do
  begin
    Component := Components[i];
    if (Component is TControl) then
    begin
      Assert(Assigned(Component));
      if IsPublishedProp(Component, 'Font') then
        TFont(GetObjectProp(Component, 'Font', TFont)).Color := ANewColor;
    end;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  SetAllFontColor(clRed);
end;

_________________
MFG
Michael Springwald, "kann kein englisch...."