3

I have an issue with showing Popup Menu in a Windows application. I have no opportunity to set it's font size. I need to do this, for example, when I have two monitors with different DPI and want to show the menu at the monitor with a DPI different from the system DPI. The application I create uses Per Monitor DPI Aware manifest.

I know that in Windows 10 it's possible to create menu with a particular DPI Awareness Context so it will be bitmap stretched (found the information here), but I would like to not to stretch anything. In addition, creating menu with a System or Unaware DPI Aware Context leads to it's incorrect behavior like bad mouse positioning in the menu.

deserg
  • 71
  • 1
  • 7
  • You need to show your code. – Andrew Truckle Feb 27 '17 at 15:02
  • 1
    I don't think it will help solve the issue. I just create menu and add some items to it: CMenu menu; menu.CreatePopupMenu(); menu.AppendMenuW(MF_STRING, 1000, L"text"); – deserg Feb 27 '17 at 15:22
  • 2
    The menu font can't be changed in any way for the application. If you want to draw a menu different you need to use owner draw features. Add the information to your question what manifest you are using for the application. – xMRi Feb 27 '17 at 16:02
  • 1
    I know this tutorial is version Visual C++ 6 but the concept should be useful: http://www.codeguru.com/cpp/controls/menu/article.php/c3721/Create-an-Owner-Draw-Menu--Step-by-Step.htm – Andrew Truckle Feb 27 '17 at 18:16
  • 1
    Owner draw menu is an option, but I would like to use some easier solution... – deserg Feb 28 '17 at 10:09
  • @xMRi, [EnableNonClientDpiScaling](https://msdn.microsoft.com/en-us/library/windows/desktop/mt748621%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396) function allows Windows 10 apps to scale some it's parts like caption bar, the scrollbars, and the menu bar when DPI changes. But scaling won't work for Popup Menu, so I was wondering if there is any other simple solution like calling EnableNonClientDpiScaling. – deserg Feb 28 '17 at 10:13
  • @deserg. There is no way with the current API to achive this. Using the MFC next would allow you to use the customized menus that are already ownerdrawn.., you didn't wrote what MFC version you are using. – xMRi Feb 28 '17 at 10:39
  • @xMRi, the one that is included in Vusial Studio 2013. Could you please share a link to this menu description? – deserg Feb 28 '17 at 11:23
  • Look at CMFCPopupMenu – xMRi Feb 28 '17 at 11:39

0 Answers0