[DUG] Form font substitution

Jason Coley Jason at software-solutions.co.nz
Tue Jul 18 08:08:17 NZST 2006


Thanks for that, works well, apart from a bug on one of the TMS controls
which I'l sort out with them.

Jason

-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On Behalf Of Jeremy North
Sent: Monday, 17 July 2006 1:58 p.m.
To: Jason
Subject: Re: [DUG] Form font substitution

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 <Jason at software-solutions.co.nz> 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: delphi-bounces at ns3.123.co.nz 
> [mailto:delphi-bounces at ns3.123.co.nz]
> 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
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
>
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi





More information about the Delphi mailing list