1

I have a vcl application with Delphi 10 Seattle with the high dpi awareness checked (which seems to be the default setting if you create a new application). In my application I have a popupmenu with icon images at the items. When the menu popups, everything looks fine (see picture 1). When moving with the mouse over the menu from down to up, all icons are disappearing where the mouse has been hovering (see picture 2). The icons however reappear if you move the mouse back from top to bottom.

Has anybody seen this effect before? Is there any cure?

By the way: This effect does not happen if the high dpi awareness is not checked in the projects settings.

This effect can be easily reproduced: (Of course only if you have a high dpi screen with scaling turned on)

  1. Create a new vcl project
  2. Add a popupmenu and an imagelist
  3. Set imagelist size to 32 pixels (I have 200% scaling)
  4. Add some items in the popup and some icons in the imagelist
  5. Set the forms popup property, the popups images porperty and the items index properties.
  6. Run and move the mouse...

picture1: menu as it should look like

picture2: menu after moving the mouse above the lower items

4
  • 1
    Delphi standard VCL menu code custom draws its menus when they have glyphs. Even if using the standard Windows theme. It's a shame that they do this and the code has always been acutely bug ridden. It has got better but it still has defects. Myself I moved away from this code a long time ago and modifed the VCL to get it to paint the menus. It manages to perform this task correctly. The secret is to create PARGB32 bitmaps from your icons and provide them to the MENUITEM in the hbmpItem field. stackoverflow.com/a/23254467/505088 Oct 12, 2016 at 8:07
  • 1
    Please file a bug report with Embarcadero at Quality Portal. The VCL has tons of DPI-related problems, several related to menu drawing. Oct 12, 2016 at 8:16
  • This all sounds like bad news... Thank you for the explanation David. I will look into your code, but I am however hesitant to change the VCL. Couldn't I provide the icons as you do by dynamically changing the menu items at startup of the application? Oct 12, 2016 at 9:12
  • Note that this was fixed in 10.1 Berlin.
    – David
    Feb 23, 2017 at 12:09

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.