You will have to create a bitmap before using it with GetBitmap.
You will have to use Overlay to assign an overlay index to one of the images in the list.
var
vBm: TBitMap;
vOverlay: TOverLay;
begin
vBm:= TBitMap.Create; // create Bitmap before using GetBitmap
try
if Main.GetBitmap(0, vBm) then // can be done but will be painted over by DrawOverlay
begin
vOverlay := 1; // use eg. 1 of the possible 4 indices (0..3)
Main.Overlay(1,vOverlay); // define second image in List to overlay index 1 to enable it as overlay image
if CheckBox1.Checked then
begin
Main.DrawOverlay(vBm.Canvas, 0, 0, 0 , vOverlay, True);
end
else
begin
Main.DrawOverlay(vBm.Canvas, 0, 0,0, vOverlay, False);
end;
//TheButton.Glyph.Assign(vBm);
end;
finally
vBm.Free;
end;
end;