I would like to know how to paint items Listview.
My situation is as follows: I have a listview where every time you do a check and this check returns true, you have to change the listview line color. I saw examples by changing the color, but I cannot adapt to what I want.
procedure TForm1.OncustomDrawItem(Sender: TCustomListView; Item: TListItem;
State: TCustomDrawState; var DefaultDraw: Boolean);
begin
if corlistview then Begin
LstbxDados.Canvas.Brush.Color:= RGB(0, 0, 0);
corlistview := false;
End;
end;
Procedure
var corlistview : boolean = false;
procedure carrega(t:String);
begin
if beginNada then begin
corlistview := true;
end;
LstbxDados.Items.BeginUpdate;
try
countX := countX +1;
with LstbxDados.Items.Add do begin
Caption := IntToStr(i+1);
Subitems.add(title);
Subitems.add(url);
end;
finally
LstbxDados.Items.EndUpdate;
end;
end;
How do I adapt the code for my situation?