I am drawing small 16x16 bitmaps onto cells in TStringGrid, but having a problem
with TStringGrid.Canvas.FillRect. In Delphi, the code below worked:
lBitmap := TBitmap.Create;
try
ExtenImages.GetBitmap(iIndex, lBitmap);
with (Sender as TStringGrid).Canvas do
begin
TStringGrid(Sender).Canvas.FillRect(aRect);
Draw(aRect.Right - lBitmap.Width - 2 , aRect.Top, lBitmap);
// (1) usually code here to redraw text in cell
end;
finally;
lBitmap.free;
end;
The problem I have is that after I call FillRect(), the cell's text is still
there. Usually I would put code in after I draw the bitmap (1), to redraw
cell's text, but the original text drawn on the cell previously does not get
cleared with FilleRect() and I end with two copies of the drawn text at
different position in the cell. Not quite the position to make it look 3d if
you know what I mean.
My current workaround is to not redraw the text in the OnDraw event and to draw
the bitmap right aligned in the cell as you can see above.
Anyway, not sure if it's a difference between delphi and lazarus versions of
TStringGrid and I need to compensate for it or maybe its a "software runtime
inconsistency" as I like to tell my customers ;)
--
Warm Regards,
Lee
"Everything I needed to learn in life, I learned selling encyclopedias door to
door."
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives