0

Description:

I am using PNG loaded imagelists to allow transparency in my menu's and speed buttons. Also using runtime themes to allow user defind GUI experiance.

If no style is selected, a.k.a. the "Windows" style, nice masks are generated for my toolbar, and everything works as expected. However, when I activate a style (no matter which one) a very strange rendering of the masks is performed, where some buttons appear to be empty (first and prior buttons) when disabled , and some (post and cancel buttons) actually do show a minimal mask of the original image.

Research: I have created a VCL style testing app, and am prying into the VCL to find out exactly how the drawing process proceeds. My research on SO here came with this more or less related topic, but id dint really help to get around my problem.

Meanwhile I can imagine someone else has bumbed into this and can point me in the rioght direction.

The question:

I am looking for a way to have these masks displayed correctly, or auto generated (like this link) which allows the work it as expected even when using VCL styles. This could by creating masks automatically in my imagelists, or , preferably, by changing the behavior that generates masks for the styles custom drawing.

Standard style shows toolbar fine: Standard style shows toolbar fine

Using custom style, no images on buttons: using custom style, no images on buttons

Another custom style, and you will even miss the buttons Another custom style, and you will even miss the buttons

BTW: "Dont use styles" would not be the answer I am looking for.

4

1 回答 1

1

事实证明,有一个无证财产Vcl.Controls.TImageList.GrayscaleFactor

如果那里除了 0 之外的任何内容,则在使用样式时,图像将以灰色方式正确呈现。

灰度因子本身似乎对最终禁用按钮的“暗度”有影响。默认值为 0,这会产生上述问题中的行为。如果没有运行时主题处于活动状态,Grayscalefactor 似乎无效。

就我个人而言,如果 GrayscaleFactor 也会影响透明度,我会更喜欢它,因此按钮看起来更像“幻影”而不是“灰色”。灰色可能不适用于所有主题......想象一个“灰色”主题:)

下面是 TImageList.Grayscalefactor 对 windows 10 蓝色主题的影响。

灰度系数=1 灰度系数=1

灰度系数=128 灰度系数=128

GrayScaleFactor=255(最大允许值) GrayScaleFactor=255(最大允许值)

于 2018-06-15T14:51:02.200 回答