在treeview控件中鼠标右键点击某一节点,光标始终定位在原来r 节点上,不能定位到目的节点上,是不是只能用左键定位?请各位大虾指点,在mousedown事件中如何实现?

解决方案 »

  1.   

    设其RightClickSelect为True试一试
      

  2.   

    weizi2000(秋风啊):RightClickSelect为True不行
      

  3.   

    是啊不知是不是TTreeView之Bug,我也继续关注……
      

  4.   

    帮助上说,
    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自己写吧,在TTreeView的MouseUp或其MouseDown事件中:
    procedure TForm1.TreeView1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      if Button = mbRight then
        if TreeView1.GetNodeAt(X, Y) <> nil then
          TreeView1.GetNodeAt(X, Y).Selected := true;
    end;