Т.е. если item'a из первого листбокса нету во втором листбоксе, то выделить его красным цветом?
Если я правильно понял, то вот простейший код:
Код:
1 2 3 4 5 6 7 8 9 10 11 | procedure TForm1 . ListBox1DrawItem(Control: TWinControl; Index: Integer ;
Rect: TRect; State: TOwnerDrawState);
begin
With ListBox1 do begin
If Listbox2 . Items . IndexOf(Items[index]) = - 1 then begin
Canvas . Font . color := clred;
end else
Canvas . Font . Color := clgreen;
Canvas . TextOut(Rect . Left + 1 ,Rect . Top + 1 ,items[index]);
end ;
end ;
|
ListBox1 - OwnerDrawFixed