Supporting System Font in Delphi Applications

Another issue of Delphi applications is that default font on forms is MS Sans Serif 8, meanwhile Windows default system font is Tahoma 8.25, and may be different at all - someone could set system font to be Comic Sans MS, or Lucida Sans Unicode, etc.

Here is Delphi code to make Delphi applications use default system font, opposed to MS Sans Serif 8:

procedure TgxCustomForm.FormCreate(Sender: TObject); begin   NonClientMetrics.cbSize := SizeOf(NonClientMetrics);   SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @NonClientMetrics, 0);   Font.Handle := CreateFontIndirect(NonClientMetrics.lfMessageFont);   if Scaled then   begin     Font.Height := NonClientMetrics.lfMessageFont.lfHeight;   end; end;

Comments for this post

dr9azya9fsvfrfvb

dr9azya9fsvfrfvb

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

More information about formatting options

»