Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2007.04.08;
Скачать: CL | DM;

Вниз

ListView   Найти похожие ветки 

 
TApp   (2007-03-14 15:20) [0]

Пытаюсь сделать собственную отрисовку ListView, подскажите как перехватить изменение ширины колонок, знаю что TWMNotify а дальше...

procedure TFrmMain.ListViewCNDrawItem(var Message: TWMDrawItem);
begin
 with Message.DrawItemStruct^ do begin
   if (itemState and ODS_SELECTED) <> 0 then
   begin
     with LV.Canvas do
     begin
       Pen.Color:= clRed;
       Brush.Color:= clHighlight;
       Font.Color:= clWhite;
       Rectangle(rcItem.Left + 18, rcItem.Top, LV.ClientWidth, rcItem.Bottom);
     end;
   end else
   begin
     with LV.Canvas do
     begin
       Pen.Color:= clWhite;
       Brush.Color:= clWhite;
       Font.Color:= clBlack;
       Rectangle(rcItem.Left + 18, rcItem.Top, LV.ClientWidth, rcItem.Bottom);
     end;
   end;
   TextOut(LV.Canvas.Handle, rcItem.Left + 20, rcItem.Top + 1,
     PChar(LV.Items.Item[itemID].Caption),
       Length(PChar(LV.Items.Item[itemID].Caption)));
   TextOut(LV.Canvas.Handle, LV.Columns[1].Width + 3, rcItem.Top + 1,
     PAnsiChar(LV.Items.Item[itemID].SubItems.Strings[0]),
       Length(PAnsiChar(LV.Items.Item[itemID].SubItems.Strings[0])));
   ImageList1.Draw(LV.Canvas, rcItem.Left + 1, rcItem.Top, 0, true);
   LV.Canvas.Handle:= 0;
 end;
end;

procedure TFrmMain.ListViewCNMeasureItem(var Message: TWMMeasureItem);
begin
 with Message.MeasureItemStruct^ do begin
   ItemHeight:= 16;
 end;
end;

procedure TFrmMain.ListViewWndProc(var Message: TMessage);
begin
 if Message.Msg = CN_DRAWITEM then
   ListViewCNDrawItem(TWMDrawItem(Message))
 else
 if Message.Msg = CN_MEASUREITEM then
   ListViewCNMeasureItem(TWMMeasureItem(Message))
 else
   OldListViewWndProc(Message);
end;

procedure TFrmMain.FormCreate(Sender: TObject);
begin
 OldListViewWndProc:= LV.WindowProc;
 LV.WindowProc:= ListViewWndProc;
end;


 
MBo ©   (2007-03-14 16:29) [1]

проверять NMHdr.code
HDN_BEGINTRACK, HDN_TRACK, HDN_BEGINTRACKW, HDN_TRACKW


 
TApp   (2007-03-14 17:13) [2]


> MBo ©   (14.03.07 16:29) [1]


А примером не поможете плизззз..



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

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

Наверх




Память: 0.47 MB
Время: 0.036 c
6-1161583477
Makhanev Alexander
2006-10-23 10:04
2007.04.08
Блокирвоание url ов...


15-1173460202
Zhjaeve
2007-03-09 20:10
2007.04.08
Касательно языка


2-1174118100
Boker
2007-03-17 10:55
2007.04.08
TImage - невозможна загрузка ...??


15-1173879454
Knight
2007-03-14 16:37
2007.04.08
Дайте пару советов по установке...


2-1173883057
Самовар глазами чайника
2007-03-14 17:37
2007.04.08
Как получить список дисков в системе