delphi - How to use TImageList.DrawOverlay? -


i use d2007 , tcxbutton glyph image devexpress should same image. button have 2 states , on second state want draw overlay on original image. in case have 1 imagelist called main. main image stored on index 0 , overlay on index 1. made small testproject don't work:

procedure tform6.checkbox1click(sender: tobject); var   vbm: tbitmap;   voverlay: toverlay; begin   if main.getbitmap(0, vbm)   begin     voverlay := 1;     if checkbox1.checked     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 assume main image , overlay must in same imagelist ? don't compiles, got

[dcc error] unit6.pas(41): e2250 there no overloaded version of 'drawoverlay' can called these arguments

edit:

tried suggested solution. compiled nothing happened. here link project https://www.dropbox.com/sh/tk5n7frkbveyxbz/d1o4ags9fs/overlay

you have create bitmap before using getbitmap.
have use overlay assign overlay index 1 of images in list.

var   vbm: tbitmap;   voverlay: toverlay; begin   vbm:= tbitmap.create; // create bitmap before using getbitmap   try   if main.getbitmap(0, vbm) // can done painted on drawoverlay   begin     voverlay := 1; // use eg. 1 of possible 4 indices (0..3)     main.overlay(1,voverlay); // define second image in list overlay index 1 enable overlay image     if checkbox1.checked     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;       vbm.free;   end; end; 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -