RightClickSelect affects only the value of the Selected property. It does not cause the tree view to highlight a new node if the node is selected using the right mouse button. 只设置tv1.Selected的Value,不产生Highlight。
procedure TForm1.TreeView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if ssRight in Shift then if TreeView1.GetNodeAt(X, Y)<>nil then TreeView1.GetNodeAt(X, Y).Selected:=True; end;
to smiler007(笑一笑) : 你说的办法挺好用。 可是你的这个办法和RightClickSelect这个属性的值没有任何关系的啊。也就是说RightClickSelect这个属性没什么用?呵呵
只设置tv1.Selected的Value,不产生Highlight。
我不是说右键会产生高亮,而是右键点击后,treeview.selected这个结点也没有发生变化啊。而按帮助里说的,treeview.selected这个结点应该会发生变化的
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if ssRight in Shift then
if TreeView1.GetNodeAt(X, Y)<>nil then TreeView1.GetNodeAt(X, Y).Selected:=True;
end;
你说的办法挺好用。
可是你的这个办法和RightClickSelect这个属性的值没有任何关系的啊。也就是说RightClickSelect这个属性没什么用?呵呵
我的要求就是右键点击时和左键一样选中结点,rightclickselect这个属性不是做这个事情的?