I use D2007 and TcxButton with a glyph image from Devexpress but it should be the same for any image. The button have 2 states and on the second state I want to draw an overlay over the original image. So in this case I have 1 Imagelist called Main. The main image is stored on index 0 and the overlay on index 1. I made a small testproject but don't get this to work:
procedure TForm6.CheckBox1Click(Sender: TObject);
var
vBm: TBitMap;
vOverlay: TOverLay;
begin
if Main.GetBitmap(0, vBm) then
begin
vOverlay := 1;
if CheckBox1.Checked then
begin
// procedure DrawOverlay(Canvas: TCanvas; X, Y: Integer; ImageIndex: Integer; Overlay: TOverlay; Enabled: Boolean = True); overload;
Main.DrawOverlay(vBm.Canvas, 0, 0, vOverlay, True);
end
else
begin
Main.DrawOverlay(vBm.Canvas, 0, 0, vOverlay, False);
end;
end;
end;
So I assume main image and overlay must be in the same Imagelist ? Now it even don't compiles, I got
[DCC Error] Unit6.pas(41): E2250 There is no overloaded version of 'DrawOverlay' that can be called with these arguments
Edit:
Tried the suggested solution. It compiled but nothing happened. Here is a link to the project https://www.dropbox.com/sh/tk5n7frkbveyxbz/D1O4Ags9fS/Overlay