Board index » delphi » Change Default Font in ShowMessage()

Change Default Font in ShowMessage()

How can I change the System Default Font with Delphi?

I would like to change the default font (Ms Sans Serif) when using Dialog
functions, such as

MessageDlg()
ShowMessage()
... and others,

in the Dialogs unit.

Any help?  Thanks.

David Poloche
dpolo...@aep.com

 

Re:Change Default Font in ShowMessage()


I found this code in dialogs.pas. It assigns the font property of
a message to windows default message font.
(it uses WinAPI SystemParametersInfo to get default message font)
May be this information will be helpful.
Regards, Alexander Dymo.

constructor TMessageForm.CreateNew(AOwner: TComponent);
var
  NonClientMetrics: TNonClientMetrics;
begin
  inherited CreateNew(AOwner);
  NonClientMetrics.cbSize := sizeof(NonClientMetrics);
  if SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @NonClientMetrics, 0)
then
    Font.Handle := CreateFontIndirect(NonClientMetrics.lfMessageFont);
end;

Quote
David Poloche wrote in message <88s770$3c...@bornews.borland.com>...
>How can I change the System Default Font with Delphi?

>I would like to change the default font (Ms Sans Serif) when using Dialog
>functions, such as

>MessageDlg()
>ShowMessage()
>... and others,

>in the Dialogs unit.

>Any help?  Thanks.

>David Poloche
>dpolo...@aep.com

Other Threads