Вниз
Скачать: CL | DM;

Цветные строки в ListView...   Найти похожие ветки 

← →
tytus ©   (2003-08-11 17:28) [0]

Хелп!!! Никак не получается писать строки в ListView разным цветом...
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
for i:=1 to 10 do
begin
n:=i;
{ListView1.Items.Add.Caption:="Item "+IntToStr(i);}(-так пишет но одним цветом - синим...)
end;
end;

procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
if odd(n) then
begin
ListView1.Canvas.Font.Color:=clRed;
ListView1.Canvas.TextOut(0,n*10,"Item"+IntToStr(n));
end
else
begin
ListView1.Canvas.Font.Color:=clHotLight;
ListView1.Canvas.TextOut(0,n*10,"Item"+IntToStr(n));
end;
end;


← →
Семен Сорокин ©   (2003-08-11 17:32) [1]

DefaultDraw indicates whether the list view should continue with the default painting after the event handler exits. Set DefaultDraw to false to prevent the drawing of the list view after event handler exits. If DefaultDraw remains set to true, the list view continues with the default painting process.


← →
tytus ©   (2003-08-11 18:00) [2]

Народ!!! Все РАБОТАЕТ!
if odd(n) then --- все дело в глобальной переменной n. Если написать if odd(item.index) то все будет работать...!



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.44 MB
Время: 0.017 c
7-81978
Red Alert
2003-06-09 13:09
2003.08.25
Как получить информацию о COM и LPT портах в системе?


1-81695
Антон
2003-08-14 21:00
2003.08.25
Какое событие возникает при кликаньи на скроллбар Листбокса


1-81683
Relaxxx
2003-08-10 19:10
2003.08.25
Очистить полностью StringGrid


3-81588
L.N.N.
2003-07-29 15:41
2003.08.25
Memo показывает только первую строчку


1-81811
TCrash
2003-08-13 18:39
2003.08.25
Переименование каталога




   Наверх