Autor Beitrag
Holgerwa
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 325

WIN XP Pro, Vista Business
Delphi 7 Pro, BDS 2006 Pro
BeitragVerfasst: Mo 06.11.06 20:55 
Hallo,

ich möchte für eine Anwendung den in den Controls angezeigten Font bei Bedarf ändern. Werden also z.B. alle Controls mit "Times Roman" angezeigt, so möchte ich per Button alle z.B. auf "Arial" umschalten.
ausblenden Delphi-Quelltext
1:
2:
3:
  for i := 0 to Form.ComponentCount - 1 do
    if Form.Components [i] is TControl then
      TControl (Form.Components [i]).Font := 'Arial';

Das funktioniert leider nicht, weil die Font-Eigenschaft von TControl protected ist.
Wie könnte man das machen? Ist TControl als Basisklasse zur Entscheidung, ob eine Font-Eigenschaft vorhanden ist, sinnvoll?

Danke!
Holger
Holgerwa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 325

WIN XP Pro, Vista Business
Delphi 7 Pro, BDS 2006 Pro
BeitragVerfasst: Mo 06.11.06 22:27 
Hallo,

ich habe diesen Beitrag gefunden:
www.delphi-library.d...iewtopic.php?t=28204
Jetzt kann ich von jeder Komponente aus Form.Componente[i] feststellen, ob die Eigenschaft 'Font' existiert. Der erste Schritt ist getan.
Aber wie komme ich nun an 'Font.Name', um diesen zu ändern?

Holger