- This topic has 6 replies, 2 voices, and was last updated 10 years ago by ralfiii.
-
AuthorPosts
-
October 29, 2014 at 3:14 pm #36344ralfiiiParticipant
The normal TImageList component offers a method “TImageList.Draw” to paint images to a canvas.
When the last parameter (Enabled) is false, then the image is painted in a disabled grayed look.
Draw also works for TsAlphaImageList, but the last parameter is completely ignored.
I also tried to use DrawAlphaImgListDC, but didn't manage to get grayscale picures.
So how do get the disabled look?
(see attached pic)
Thanks!
Ralf
November 3, 2014 at 3:39 pm #52698SupportKeymasterHello Ralf!
acAlphaImageList unit contains the DrawAlphaImgList function:
Code:function DrawAlphaImgList(const ImgList: TCustomImageList; const DestBmp: TBitmap; const Left: integer; const Top: integer; const ImageIndex: integer; const Blend: integer; const GrayedColor: TColor; State: integer; const NumGlyphs: integer; const Reflected: boolean): TSize;This function allows to draw a glyph with many parameters, I hope it helps.
Please, look it, and write again if you have questions.
November 3, 2014 at 3:59 pm #52699ralfiiiParticipantHello!
I tried that function, but I didn't manage to get grayed glyphs.
Here's the code that belongs to the screenshot from my previous post:
Code:// The color of the pixel in the lower left corner defines the transparency color
for counter:=0 to ImageList1.Count-1 do
ImageList1.Draw(Canvas, 10,10+40*counter, counter);
for counter:=0 to ImageList1.Count-1 do
ImageList1.Draw(Canvas, 30,10+40*counter, counter, False);for counter:=0 to sAlphaImageList1.Count-1 do
sAlphaImageList1.Draw(Canvas, 50,10+40*counter, counter);
for counter:=0 to sAlphaImageList1.Count-1 do
sAlphaImageList1.Draw(Canvas, 70,10+40*counter, counter, False);
for counter:=0 to sAlphaImageList1.Count-1 do
DrawAlphaImgListDC(sAlphaImageList1, Canvas.Handle, 90, 10+40*counter, counter,
0 {Blend}, $BEA76D {GrayedCol}, 0 {State}, 1 {NumGlyphs}, False {reflect});
for counter:=0 to sAlphaImageList1.Count-1 do
DrawAlphaImgListDC(sAlphaImageList1, Canvas.Handle, 110, 10+40*counter, counter,
50 {Blend}, clNone {GrayedCol}, 0 {State}, 1 {NumGlyphs}, False {reflect});I didn't manage to make the GreyedCol parameter do something meaningful.
Could you change the code so the back arrow is properly grayed?
Or is the only way to draw the images transparent?
Thanks,
Ralf
November 3, 2014 at 4:17 pm #52700SupportKeymasterIf glyphs must be gray toned, then leave 0 there.
GrayedCol is a tone for glyph (if clRed, then glyph will have red tones).
November 4, 2014 at 9:44 am #52705ralfiiiParticipantHey!
Ok, if I call
Code:DrawAlphaImgListDC(sAlphaImageList1, Canvas.Handle, 10, 10, 0,
0 {Blend}, 0 {GrayedCol}, 0 {State}, 1 {NumGlyphs}, False {reflect});then the bitmap really becomes monochrome, but an icon that was completely black is still black. So it doesn't look disabled.
To get such an icon the proper look I have to call with Blend=70
But if I do that, an icon that was only in colors suddenly is extremely pale.
see attached pic.
In my case that's no problem, I know the graphics and only need it for one special case, but the way DrawAlphaImgListDC works now is not good for a general solution.
Best regards,
Ralf
November 10, 2014 at 1:39 pm #52716SupportKeymasterI understand what you mean, but I have no idea how to improve it at the moment. I have added this issue in ToDo list and I will think later about that.
November 10, 2014 at 1:44 pm #52717ralfiiiParticipant'Support' wrote:I understand what you mean, but I have no idea how to improve it at the moment. I have added this issue in ToDo list and I will think later about that.
Ok, no problem.
Thanks.
-
AuthorPosts
- You must be logged in to reply to this topic.