Reputation: 2456
What is the Win32 API call to determine the system-wide font (in particular the color) for say Menus.
This would be equivalent to going into Appearance Settings - Advanced - and then choosing Menu as the item to look at.
I can use GetSysColor to find the colors of various system-wide window elements, but cannot find the equivalent for fonts.
Upvotes: 6
Views: 4899
Reputation: 108800
You can use SystemParametersInfo
to find these fonts:
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ...)
returns a NONCLIENTMETRICS
structure containing LOGFONT
structures for:
lfCaptionFont
-- font used for both "Active Title Bar" and "Inactive Title Bar"lfSmCaptionFont
-- font used for small title bars, "Palette Title"lfMenuFont
-- font used in menu bars.lfStatusFont
-- font used in status bars and tooltipslfMessageFont
-- font used in message boxes.SystemParametersInfo(SPI_GETICONTITLELOGFONT, ...)
returns a LOGFONT
structure for the text accompanying icons.
In C# / .NET you can use the System.Drawing.SystemFonts
class (WinForms) or the System.Windows.SystemFonts
class (WPF).
Upvotes: 7
Reputation: 1511
GetSysColor(COLOR_MENUTEXT) gives you the menu font colour.
SystemParametersInfo Will allow you to recover some font information, likewise GetStockObject for drawing on the device context.
But the system font is (probably) either Tahoma (on XP/W2K) or MS Sans Serif depending on how you set up your Dialog.
See http://blogs.msdn.com/oldnewthing/archive/2005/02/04/366987.aspx for more.
Upvotes: 3
Reputation: 386
In C#, there's Control.DefaultFont, and for native access, this blog describes the win32 API call for getting it. The API call is SystemParametersInfo().
Upvotes: 0