gyulak
gyulak

Reputation: 31

How to set default form font in Delphi Alexandria

Just installed Delphi 11 (Alexandria) and starting to convert our project to it (from 10.4, we try to keep up-to-date). I was surprised to see that our pixel-perfect (and quite crowded) data entry forms with dozens of TDBEdits were out of shape.

After a short research I found that amongst other changes, "For VCL applications, the default font is now Segoe UI, 9 pt.". Our forms are designed for "Tahoma, 8 pt", the former default font. At runtime I can fix it with altering the Application.DefaultFont at the start of the application, but we just cannot do development work on the forms while the fonts are bigger than the form was designed for.

All of our forms use the ParentFont = True setting, so I would like to change the default fonts for the form designer. For older Delphi versions there was a registry setting that controlled this, as seen at https://suretalent.blogspot.com/2011/07/how-to-set-default-form-font-delphi.html

I did the changes as mentioned on the url above, with no luck. Is there a setting I could use for this?

Upvotes: 3

Views: 1869

Answers (1)

John
John

Reputation: 1

In some unit (eg. with design-time editors):

type
  TMyFormCustomModule = class(TCustomModule)

constructor TMyFormCustomModule.Create(ARoot: TComponent; const ADesigner: IDesigner);
begin
    if Application.DefaultFont.Name = 'Segoe UI' then begin
      Application.DefaultFont.Name := ' Tahoma';
      Application.DefaultFont.Height := -11;
    end;
end;

In a design-time package register:

  RegisterCustomModule(TForm, TMyFormCustomModule);

Upvotes: 0

Related Questions