Zonder subitemdraw ziet alles er goed uit. Echter wordt alle tekst na gebruik van een image bold afgedrukt.
Ik weet niet waarom. Ik gebruik verder geen fontselectie Ondanks de fontstyle leeg te maken, komt de tekst na de ownerdraw terug als bold.
Heeft iemand enig idee hoe ik dat moet oplossen?
Delphi Code:
procedure TFrmBasisGrootboeknummers.ListView1CustomDrawSubItem(
Sender: TCustomListView; Item: TListItem; SubItem: Integer;
State: TCustomDrawState; var DefaultDraw: Boolean);
var aRect : TRect;
iWidth, X : smallint;
Bmp : TBitmap;
begin
if (subitem=4) then
begin
Bmp := TBitmap.Create;
try
if item.SubItems[subitem - 1] = 'A' then
LVImagelist.GetBitmap(0, Bmp)
else
LVImagelist.GetBitmap(1, Bmp);
aRect:=Item.DisplayRect(drBounds);
iWidth := 0;
For X := 0 to 3 do
iWidth := iWidth + listview1.Column[X].Width;
Sender.Canvas.Draw(aRect.Left + iWidth - 2, aRect.Top, Bmp);
Sender.Canvas.Font.Style := [];
finally
bmp.Free;
end;
DefaultDraw:=False;
end;
end;
Bookmarks