글쎄, 나는 다음과 같은 문제가있다. 예 :VirtualStringTree CellPaint
- isProcessService,
- isProcessInDebugger,
- isProcessService,
- isProcessElevated,
- isProcessNet,
- isProcessOwner,
- isProcessinJob,
- isProcessPacked,
- isProcessMarkedForDeletion,
- isProcessMarkedForCreation : 부울;
그래서 BeforeCellPaint에서 내가 좋아하는 그 논리 값에 따라 셀 배경 색상을 칠 것이다 :
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;
질문 : 나는 녹색 또는 적색 따라 셀을 그릴 수있는 방법을
프로세스가 생성되거나 삭제 될 것입니다 (최소한 1 초 동안 색상을 유지 한 다음 다시 원래 값으로 전환하십시오).
다른 w 프로세스가 생성되면 초록색 셀을 기다렸다가 isProcessService, ProcessOwner 등등에 따라 원래의 색으로 다시 전환하십시오.
가장 큰 문제는 비 차단 모드에서 필요합니다. (수면을 사용할 수 없다면 나무도 얼어 붙어 색이 바뀌지 않을 것입니다.)
나를 따라갈 수 없다면, 프로세스 탐색기 나 프로세스 해커와 같은 행동을 모방하려고합니다. 프로세스가 생성되거나 삭제됩니다. 두 응용 프로그램은 빨간색 또는 초록색 프로세스를위한 셀 배경을 칠한 다음 셀이 가진 원래 색으로 다시 전환합니다.
정보를 얻으려면 wmi를 통해 프로세스 생성 또는 삭제에 대한 알림을 받게됩니다.
'TargetCanvas.ClipRect'가 아닌'CellRect'를 사용하십시오. –
어떻게 처리 목록의 변경 사항을 처리합니까? 끊임없이 트리를 다시 작성합니까? 필요에 따라 노드를 추가/삭제합니까? BTW, VT에서 셀의 배경색을 설정하는 올바른 방법은'BeforeCellPaint'가 아니라'BeforeItemErase' 이벤트 ('EraseAction : = eaColor')를 사용하는 것입니다. – ain
당신은 litte를 혼동스러워합니다 – stOrM