Google

Monday, March 19, 2007

Change the font for all controls at run-time

procedure ModifyFontsFor(ctrl: TWinControl);
procedure ModifyFont(ctrl: TControl);
var
f: TFont;
begin
if
IsPublishedProp(ctrl, 'Parentfont')
and (GetOrdProp(ctrl, 'Parentfont') = Ord(false))
and IsPublishedProp(ctrl, 'font')
then begin
f := TFont(GetObjectProp(ctrl, 'font', TFont));
f.Name := 'Symbol';
end;
end;
var
i: Integer;
begin
ModifyFont(ctrl);
for i := 0 to ctrl.controlcount - 1 do
if
ctrl.controls[i] is Twincontrol then
ModifyFontsfor(TWincontrol(ctrl.controls[i]))
else
Modifyfont(ctrl.controls[i]);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Modifyfontsfor(self);
end;

1 comment:

Sergey said...

If you’re looking for Java development, you may be interested to know more about the developers from this eastern european country. Check out this article to learn more about the Java software development company in Ukraine.