2006. november 23., csütörtök
How to set a system-wide font for dialogs
Problem/Question/Abstract:
I have a custom dialog. So far I have set the font to Verdana. What I would like to do is to be able to set the dialog font to the one that's currently being used.
Answer:
This code sets the font of dialogs system-wide to Verdana:
procedure TForm1.Button1Click(Sender: TObject);
var
ncm: TNonClientMetrics;
begin
ncm.cbSize := SizeOf(TNonClientMetrics);
{get old non client metrics}
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, SizeOf(TNonClientMetrics), @ncm, 0);
{lfCaptionFont - regular captions
lfSmCaptionFont - small captions
lfMenuFont - menus
lfStatusFont - status bars
lfMessageFont - message boxes}
ncm.lfMessageFont.lfFaceName := 'Tahoma';
{set new non client metrics}
SystemParametersInfo(SPI_SETNONCLIENTMETRICS, SizeOf(TNonClientMetrics), @ncm, 0);
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése