Author: Jonas Bilinkevicius
How would I get the font used in menus? I want to setup a TFont that is the same.
Answer:
Returned font becomes callers property and must be freed by it!
1 function GetMenuFont: TFont;
2 var3 ncMetrics: TNonClientMetrics;
4 begin5 ncMetrics.cbSize := sizeof(TNonClientMetrics);
6 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(TNonClientMetrics),
7 @ncMetrics,
8 0);
9 Result := TFont.Create;
10 Result.Handle := CreateFontIndirect(ncMetrics.lfMenuFont);
11 end;
The TNonClientMetrics structure also contains information on other fonts used in
the non-client area
information:
lfCaptionFont: Font used in regular captions
lfSmCaptionFont: Font used in small captions
lfMenuFont: Font used in menus
lfStatusFont: Font used in status bars
lfMessageFont: Font used in message boxes