且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

TVirtualStringTree.如何通过单个确认检查节点及其子节点?

更新时间:2023-11-26 08:31:04

使用OnMouseDown事件可获取有关鼠标单击的通知.如果是TMouseButton.mbLeft,请调用GetHitTestInfoAt(),并检查THitInfo.HitPositions中是否包含THitPositions.ctCheckBox.如果是这样,THitInfo.HitNode包含相应的节点.然后,您可能会显示确认对话框,并将结果保存到成员变量中,您可以在OnChecking事件中使用该变量来允许或禁止更改检查状态.

Use the OnMouseDown event to get notified about a mouse click. If it's TMouseButton.mbLeft call GetHitTestInfoAt() and check if THitPositions.ctCheckBoxis included in THitInfo.HitPositions. If so, THitInfo.HitNodecontains the corresponding node. You may then show the confirmation dialog and save the result in a member variable, that you can use in the OnChecking event to allow or disallow the change of the check state.