CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2010
    Posts
    14

    Correct way of getting theme font for child controls?

    The edit, button, static, listbox, and combobox controls all have that old system-looking font in them by default, even when using visual styles.

    What is the correct way of getting or creating a font for these controls that respects the current theme?

    I tried GetThemeSysFont with TMT_CAPTIONFONT and TMT_SMALLCAPTIONFONT but they both return the same font for every control, which is identical to the main window caption and too big for these controls. Should I simply take this font and decrease the size or is there some other method I should know about?

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Correct way of getting theme font for child controls?

    GetStockObject function

    DEFAULT_GUI_FONT

    Remarks

    It is not recommended that you employ this method to obtain the current font used by dialogs and windows. Instead, use the SystemParametersInfo function with the SPI_GETNONCLIENTMETRICS parameter to retrieve the current font. SystemParametersInfo will take into account the current theme and provides font information for captions, menus, and message dialogs.
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured