Ugly "disabled" images of TMainMenu
Asked Answered
A

2

14

Delphi 2010, Win32 VCL. I need to create a main menu for my application with the most standard look. TMainMenu looks nice in all Windows versions, the only bad thing is when it displaying images for items with Enabled=False.

Delphi has some strange method for building that disabled images (b/w extrusion with bevels, for me it looks like spew). I want to make a patch for that procedure in VCL sources and let menu to select disabled images from the same TImageList, but I can't find it.

Is it exists at all or it is some standard windows API call? Do you know where is that procedure located?

Sure OwnerDraw style can fix all this but I want a bit faster solution.

Adrial answered 25/6, 2010 at 9:45 Comment(0)
V
22

There's a great post on Galfar's Lair blog which describes the problem, and has code for a workaround, overriding the TImageList DoDraw method.

Here's the pic (linked) showing the 'before' and 'after'.

alt text

I think this relates to pretty much all Delphi versions.

Virilism answered 25/6, 2010 at 10:1 Comment(2)
Great! I'll override TCustomImageList.DoDraw and the disabled image will be copied from the second half of the stored image 32x16. Thank you Roddy and Galfar.Adrial
Link's broken... Which is why SO doesn't allow off-site resources as the basis of questions or answers anymore.Heracles
W
4

If you can provide your images as PNG you can use TPngImageList from PngComponents. It has different options to make a blended or grayscaled disabled image. The PNG format allows you to make use of alphablending.

Wivinah answered 25/6, 2010 at 11:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.