Re: bitmaps in TListbox reappear
besh_at_cix.compulink.co.uk
Date: 03/29/05
- Next message: Rudy Velthuis: "Re: How to add linebreak to a long string"
- Previous message: Nicholas Sherlock: "Re: bitmaps in TListbox reappear"
- In reply to: Nicholas Sherlock: "Re: bitmaps in TListbox reappear"
- Next in thread: Nicholas Sherlock: "Re: bitmaps in TListbox reappear"
- Reply: Nicholas Sherlock: "Re: bitmaps in TListbox reappear"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Mar 2005 14:23:02 -0600
> What does your OnDrawItem event look like?
Here's the full proc
procedure TForm1.ListBox3DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
Bitmap: TBitmap;
begin
with (Control as TListBox).Canvas do
begin
try
FillRect(Rect);
Bitmap := getmodimage( strtoint(getitemdata(inttostr(index), '4')),
getfbbx(1), inttostr(index), 1);
if Bitmap <> nil then
begin
BrushCopy(Bounds(Rect.Left + 2, Rect.Top, Bitmap.Width,
Bitmap.Height), Bitmap, Bounds(0, 0, Bitmap.Width,
Bitmap.Height), clRed);
end;
finally
bitmap.free
end;
end;
end;
getmodimage is a function that returns a TBitmap;
function GetModImage(wid, heit:integer;charval: string; sze:integer):
TBitmap;
showing the bitmap creation part
result := Tbitmap.create;
result.width := wid;
result.height := heit;
result.monochrome := true;
result.pixelformat := pfDevice; //changed to pfdevice from pf1bit
the rest is just bitmap drawing routines.
Since Result is a TBitmap, it cannot be freed within the function.
However the bitmap is freed in the OnDrawItem procedure.
The code works beautifylly, but for the listbox items not 'refreshing'.
Neil
- Next message: Rudy Velthuis: "Re: How to add linebreak to a long string"
- Previous message: Nicholas Sherlock: "Re: bitmaps in TListbox reappear"
- In reply to: Nicholas Sherlock: "Re: bitmaps in TListbox reappear"
- Next in thread: Nicholas Sherlock: "Re: bitmaps in TListbox reappear"
- Reply: Nicholas Sherlock: "Re: bitmaps in TListbox reappear"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|