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

LU RD
  • 34,438
  • 5
  • 88
  • 296
Andre Ruebel
  • 518
  • 3
  • 12
  • 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. http://stackoverflow.com/a/23254467/505088 – David Heffernan Oct 12 '16 at 08:07
  • 1
    Please file a bug report with Embarcadero at [Quality Portal](http://quality.embarcadero.com). The VCL has *tons* of DPI-related problems, several related to menu drawing. – Remy Lebeau Oct 12 '16 at 08: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? – Andre Ruebel Oct 12 '16 at 09:12
  • Note that this was fixed in 10.1 Berlin. – David Feb 23 '17 at 12:09

0 Answers0