How to determine the font that is used in a menu (Views: 27)
Problem/Question/Abstract: 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! function GetMenuFont: TFont; var ncMetrics: TNonClientMetrics; begin ncMetrics.cbSize := sizeof(TNonClientMetrics); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(TNonClientMetrics), @ncMetrics, 0); Result := TFont.Create; Result.Handle := CreateFontIndirect(ncMetrics.lfMenuFont); 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 |