How to add an image with transparency to a TDbgrid column in delphi? -


i trying add image column on tdbgrid takes transparency account. when drawing image timagelist on canvas in dbgriddrawcolumncell procedure, need background of image (the same color pixel in lower left corner) take on transparency. want transparency area show highlight color or non-highlight color, when themes used, such aero. have been able accomplish in older versions of windows color values of clhighlight or clwindow background color. aero themes, paints box behind non-transparent part of image instead of gradient blue highlight color aero uses. how can accomplish this?

i believe supposed use alpha channel i'm not sure how timagelist canvas. believe cell painted actual highlight color before start drawing on canvas in cell. want draw non-transparency part of image , leave background.

i able determine how display images on dbgrid transparency if themes, such aero used.

i used regular timagelist , loaded images needed display on dbgrid. in case there 2 , in icon (ico) format. instead of transferring image bitmap , drawing dbgrid canvas old code recommends, used following simple code in dbgriddrawcolumncell procedure:

if datacol=0 begin      if (mapptsconflict.value='<none>')          imageindex := 0      else          imageindex := 1;       imagelist.draw(tdbgrid(sender).canvas,rect.left+2,rect.top+2,imageindex,true); end;  

this draw directly dbgrid canvas timagelist give desired transparency.

update: tried bmp's loaded in timagelist , worked too.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -