简体   繁体   中英

How to make a larger menu font in a Windows application?

I have a Windows app written in C++ (using MFC) - Visual Studio 6.0.

A user wants all the menu items (ie. from the main application menu) to be larger because he has a big monitor. The app allows the (client) text inside the window to be drawn larger so that isn't a problem. It's just the menus.

I can get the menu as a CMenu object and from that derive the HMENU handle. I don't particularly want to have to change to owner-draw just to make a simple change like that.

Is there a way of telling Windows to use a larger version of the system font, just for menus, and just for the current app? The user doesn't want to make fonts larger for all apps (via the Control Panel) because that breaks other things.

A solution should be compatible with Windows XP onwards - not everyone is running the latest versions of Windows. It also should not affect the font used in dialog boxes as they are laid out in such a way that a larger font is likely to make part of the text disappear.

You can use some tools like the BCG Library or others like Codejock, Prof-UIS.

All this libraries use custom draw for the menus. So there it is possible to enlarge the fonts for the menu just for this program.

Another simple way would be: Just update to a newer VS-Version and you get the new menus incl. the possible flexibility of owner draw menus for free...

BTW: The user has the same problem, with other programs, he should find a better solution like scaling the size of the display font... and yes this is for all applications

You can try SystemParametersInfo with SPI_GETNONCLIENTMETRICS and SPI_SETNONCLIENTMETRICS and modifying lfMenuFont of NONCLIENTMETRICS.

See https://msdn.microsoft.com/en-us/library/windows/desktop/ff729175(v=vs.85).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM