Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.08.25;
Скачать: 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 вся ветка

Текущий архив: 2003.08.25;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.031 c
1-81756
Son!K
2003-08-09 15:19
2003.08.25
Текст в консольном приложении


1-81761
Pindos
2003-08-02 08:27
2003.08.25
Нет Юнита D s g n I n t f


14-81931
Всеволод СоловьЁв
2003-08-06 21:50
2003.08.25
Очередное предложение по организации форума


3-81598
Relaxxx
2003-07-31 13:07
2003.08.25
Рисовать в ячейках DBGrid как на канвасе


9-81518
C-D
2003-02-23 17:50
2003.08.25
Нужен алгоритм поиска путей в графе...