![]() |
Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Set a color lines in ListBox
First of all, you should set Style method to lbOwnerDrawFixed.And then use OnDrawItem event with lines:
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
Mas: array[1..5] of Integer;
begin
Mas[1]:=clRed;
Mas[2]:=clBlue;
Mas[3]:=clYellow;
Mas[4]:=clAqua;
Mas[5]:=clGreen;
with (Control as TListBox).Canvas do
begin
Brush.Color:=Mas[Index+1];
FillRect(Rect);
TextOut(Rect.Left,Rect.Top,IntToStr(Index+1));
end;
end;
-
More for developers