如何在Delphi Alexandria中设置默认表单字体



刚刚安装了Delphi 11(Alexandria(,并开始将我们的项目转换为它(从10.4开始,我们努力保持最新(。我惊讶地发现,我们的像素完美(而且非常拥挤(的数据输入表单有几十个TDBEdit,但却出现了问题。

经过短暂的研究,我发现在其他变化中;对于VCL应用程序,默认字体现在是Segoe UI,9磅;。我们的表格是为";Tahoma,8磅";,以前的默认字体。在运行时,我可以通过在应用程序开始时更改Application.DefaultFont来修复它,但当字体比表单设计的要大时,我们就不能对表单进行开发工作。

我们所有的表单都使用ParentFont = True设置,所以我想更改表单设计器的默认字体。对于较旧的Delphi版本,有一个注册表设置可以控制这一点,如https://suretalent.blogspot.com/2011/07/how-to-set-default-form-font-delphi.html

我做了上面url上提到的更改,但没有运气。有没有我可以用的设置?

在某些单元中(例如,使用设计时编辑器(:

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;

在设计时包寄存器中:

RegisterCustomModule(TForm, TMyFormCustomModule);

最新更新