Use RTTI and iterate over all the controls on each form.

procedure SetFont(AComponent: TComponent);
var
 lPropInfo: PPropInfo;
 lFont: TFont;
begin
 lPropInfo := GetPropInfo(AComponent.ClassInfo, 'Font');
 if lPropInfo <> nil then
 begin
   lFont := TFont(GetOrdProp(AComponent, lPropInfo));
   lFont.Name := 'Courier New';
   SetOrdProp(AComponent, lPropInfo, LongInt(lFont));
 end;
end;

procedure TForm13.Button1Click(Sender: TObject);
begin
 SetFont(Button1);
end;

Have to add TypInfo to uses clause.

cheers,
Jeremy

On 7/17/06, Jason Coley <[EMAIL PROTECTED]> wrote:
That kind of works, but some of the controls do not have the parent font
property, so have their own font. (Some TMS controls) I also change the
colour of some captions so the parent font is false.

Any other ideas?

Is there a way to recursively change the font names?

Jason

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Jeremy North
Sent: Monday, 17 July 2006 1:35 p.m.
To: Jason
Subject: Re: [DUG] Form font substitution

> I am in the middle of an application, and I want to use the Sergio
> font that MS use with Office 2007, and comes in Vista also.

You can try DesktopFont := True in your application (create of Main
Form).
Although this might require the Sergio font be the default font.

I haven't gotten around to installing Vista to know if this is the case.

cheers,
Jeremy
_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi



_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to