- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
procedure TForm1.ProcListAdvancedCustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
var DefaultDraw: Boolean);
var
TP:TprocessInfo;
xColor: TColor;
xRect: TRect;
xBitmap: TBitmap;
I, L, R: Integer;
begin
DefaultDraw:=False;
TP:=TProcessInfo(Item.SubItems.Objects[0]);
if (Item.Selected) then
begin
if Sender.Focused then
begin
if (FItemAtCursor <> -1) and (Item.Index = FItemAtCursor) then
xColor:=clNavy
else
xColor:=$00C56A31;
end
else
xColor:=$00D8E9EC
end
else
begin
if (TP.New<2) or (TP.Terminated<2) or (TP.Hidden) then
begin
if ShowDangerousProcesses then
if TP.Hidden then
xColor:=$00DBDBDB;
if ShowNewProcesses then
if TP.New <2 then
xColor:=$001DEB2D;
if ShowTerminatedProcesses then
if TP.Terminated < 2 then
xColor:=$001D2DEB;
end
else
if (Item.Index mod 2 = 1) then
xColor:=RGB(245,245,255)
else
xColor:=clWindow;
end;
Sender.Canvas.Brush.Color:=xColor;
DefaultDraw:=True;
if (Item.Selected) and Sender.Focused
then Sender.Canvas.Font.Color:=clWindow
else Sender.Canvas.Font.Color:=clWindowText;
Sender.Canvas.FillRect(Item.DisplayRect(drLabel));
DefaultDraw:=True;
Exit;
xRect:=Item.DisplayRect(drLabel);
Sender.Canvas.TextRect(xRect,xRect.Left+2,xRect.Top,Item.Caption);
for I:=0 to TListView(Sender).Columns.Count-1 do
begin
if TListView(Sender).Columns[TListView(Sender).Columns[I].ID].Width<=0 then Continue;
if (I=0) and (TListView(Sender).Columns[I].ID <> 0) then
begin
xRect.Left:=0;
xRect.Right:=xRect.Left+TListView(Sender).Columns.Items[TListView(Sender).Columns[I].ID].Width-1;
Sender.Canvas.FillRect(xRect);
Sender.Canvas.TextRect(xRect,xRect.Left+2,xRect.Top,Item.SubItems[TListView(Sender).Columns[I].ID-1]);
end
else
begin
if I>0 then
begin
xRect.Left:=xRect.Right+1;
xRect.Right:=xRect.Left+TListView(Sender).Columns.Items[TListView(Sender).Columns[I].ID].Width-1;
Sender.Canvas.FillRect(xRect);
if TListView(Sender).Columns[I].ID >0 then
Sender.Canvas.TextRect(xRect,xRect.Left+5,xRect.Top,Item.SubItems[Pred(TListView(Sender).Columns[I].ID)])
else
begin
L:=(Item.DisplayRect(drIcon).Right-Item.DisplayRect(drIcon).Left)+6;
Sender.Canvas.TextRect(xRect,xRect.Left+L,xRect.Top, Item.Caption)
end;
end;
end;
end;
Sender.Canvas.Brush.Color:=clWindow;
Sender.Canvas.FillRect(Item.DisplayRect(drIcon));
if Item.ImageIndex=-1 then Exit;
xBitmap:=TBitmap.Create;
TListView(Sender).SmallImages.GetBitmap(Item.ImageIndex,xBitmap);
ListView - великий и ужасный! - в режиме OwnerDraw.
Писал диспетчер процессов. Когда я разрешил прятать столбцы и включил свойство FullDrag, моя жизнь круто изменилась.
Admina_mamu_ebal 23.06.2017 16:29 # −2
antipattern 27.06.2017 00:28 # −2
administrator 27.06.2017 00:43 # −2