VirtualStringTree CellPaint

Well, I have the following problem:

I painted tree cells in different colors depending on some Boolean vars. Example:

  • isProcessService,
  • isProcessInDebugger,
  • isProcessService,
  • isProcessElevated,
  • isProcessNet,
  • isProcessOwner,
  • isProcessinJob,
  • isProcessPacked,
  • isProcessMarkedForDeletion,
  • isProcessMarkedForCreation: Boolean;

So, in BeforeCellPaint I will draw the background color of the cells based on such logic elements as:

procedure TMainForm.ProcessVstBeforeCellPaint (Sender: TBaseVirtualTree;
  TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
  CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
var
  NodeData: PProcessData;
begin
 if Node = nil then
    Exit

  NodeData: = Sender.GetNodeData (Node);

  if NodeData = nil then
    Exit

  if (NodeData ^ .isProcessOwner) then
  begin
    TargetCanvas.Brush.Color := $00AAFFFF;
    TargetCanvas.FillRect(TargetCanvas.ClipRect);
  end;

  if (NodeData^.isProcessInDebugger) then
  begin
    TargetCanvas.Brush.Color := $00E5A5A5;
    TargetCanvas.FillRect(TargetCanvas.ClipRect);
  end;

    if (NodeData^.pProcessID = 0) or (NodeData^.pProcessID = 4) then
  begin
    TargetCanvas.Brush.Color := $00FFCCAA;
    TargetCanvas.FillRect(TargetCanvas.ClipRect);
  end;

  if (NodeData^.isProcessElevated) and not(NodeData^.isProcessInDebugger) then
  begin
    TargetCanvas.Brush.Color := $0000AAFF;
    TargetCanvas.FillRect(TargetCanvas.ClipRect);
  end;

  if (NodeData^isProcessService) and
    not (NodeData^.isProcessPacked) and
    not(NodeData^.isProcessNet) then
  begin
    TargetCanvas.Brush.Color := $00FFFFCC;
    TargetCanvas.FillRect(TargetCanvas.ClipRect);
  end;

  if (NodeData^.isProcessMarkedForDeletion) then
  begin
    TargetCanvas.Brush.Color := $005D5DFF;
    TargetCanvas.FillRect(TargetCanvas.ClipRect);
  end;

  if (NodeData^.isProcessMarkedForCreation) then
  begin
    TargetCanvas.Brush.Color := $0061E15E;
    TargetCanvas.FillRect(TargetCanvas.ClipRect);
  end;

  if (NodeData^.isProcessNet) then
  begin
    TargetCanvas.Brush.Color := $005CE0BF;
    TargetCanvas.FillRect(TargetCanvas.ClipRect);
  end;
end;


:

, ( , ?)

, , , : isProcessService, ProcessOwner ..

: ( sleep, , ​​ )

, Process Explorer Process Hacker, . , .

, wmi.

+5
1

, , , , - 1 . isProcessMarkedForCreation true, . , isProcessMarkedForCreation false , . , , . .

+5

All Articles