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

ListView1.Canvas   Найти похожие ветки 

← →
alex732   (2004-03-19 18:54) [0]

Добрый день... Необходимо в ListView-е выделить некий елемент..
Пишу

procedure TForm1.ListView1Click(Sender: TObject);
begin
ListView1DrawItem(ListView1,
    ListView1.Selected,
    ListView1.Selected.DisplayRect(drLabel),
    [odSelected]);
end;

procedure TForm1.ListView1DrawItem(Sender: TCustomListView;
 Item: TListItem; Rect: TRect; State: TOwnerDrawState);
begin
 with sender.Canvas do
   begin
     Brush.Color := clBlue;
     Font.Color := clWhite;
     FrameRect(Rect);
   end;
end;

Все нормально.. Но при переходе фокуса на другой объект выделение это пропадает...  Как мне от этого избавиться???


← →
Yuri Btr ©   (2004-03-19 19:30) [1]

Хе-хех
может это поможет ?

procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
 Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
if not Item.Checked
 then
  begin
   (Sender as TCustomListView).Canvas.Brush.Color:=clCream;
   (Sender as TCustomListView).Canvas.Font.Color:=clRed;
  end
 else
  begin
   (Sender as TCustomListView).Canvas.Brush.Color:=clMoneyGreen;
   (Sender as TCustomListView).Canvas.Font.Color:=clBlue;
  end;
if (Item.Caption="1") and Item.Checked
 then
  (Sender as TCustomListView).Canvas.Font.Style:=[fsBold];
DefaultDraw:=true;
end;


← →
Yuri Btr ©   (2004-03-19 19:32) [2]

Внутри ListView1CustomDrawItem
можешь делать любую проверку на состояние Item



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

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



Память: 0.45 MB
Время: 0.027 c
7-1079529307
Dastin
2004-03-17 16:15
2004.04.11
Определение буквы CD


4-1079420083
BillyJeans
2004-03-16 09:54
2004.04.11
Шрифт у Edit a...


3-1081759274
alex123
2004-04-12 12:41
2004.04.11
ExpressQuantumGrid - значение поля в LookupComboBox программно?


14-1082051532
pepers
2004-04-15 21:52
2004.04.11
Разработка приложения


7-1075369245
Stexen
2004-01-29 12:40
2004.04.11
Клавиатура




   Наверх