虚拟树研究-CheckBox初步判断只能在第一列

时间:2021-06-16 14:59:52
//虚拟树研究-CheckBox初步判断只能在第一列
procedure TWindowsXPForm.XPTreeInitNode(Sender: TBaseVirtualTree; ParentNode, Node: PVirtualNode;
var InitialStates: TVirtualNodeInitStates); var
Data: PEntry;
begin
if ParentNode = nil then //若为父节点 就位CheckBox样式 begin
Include(InitialStates, ivsHasChildren);
Data := Sender.GetNodeData(Node);
Data^ := TreeEntries[Node.Index mod ];
Data.Size := Random();
Node.CheckType := ctTriStateCheckBox; //ctButton;//ctCheckBox; //默认为第一列
end
else
Node.CheckType := ctRadioButton; //不是父节点时就 是radio的样式
end; procedure TGeneralForm.VST2InitNode(Sender: TBaseVirtualTree; ParentNode, Node: PVirtualNode;
var InitialStates: TVirtualNodeInitStates); const
LevelToCheckType: array[..] of TCheckType = (
ctButton, ctRadioButton, ctTriStateCheckBox, ctTriStateCheckBox, ctCheckBox, ctNone
); var
Data: PNodeData2; begin
Node.CheckType := LevelToCheckType[Data.Level];
Sender.CheckState[Node] := csCheckedNormal;