请问如何设置右键点击treeview时自动选中该节点?

解决方案 »

  1.   

    treeview的onmousedown事件里写
      if Button<>mbRight then exit;
      if TreeView1.GetNodeAt(X,Y)<>NIL then
      begin
            TreeView1.Selected := TreeView1.GetNodeAt(X,Y);
      end;
      

  2.   

    设置RightClickSelected属性为true
    不行啊!右击所要点击的选项后,自动的又回复到刚才的选项!我的是dp6,会不会是我的编译器有错?
      

  3.   

    在treeview的onmousedown事件中  if Button = MBright then
      begin
        if TreeView1.Items.Count > 0 then TreeView1.GetNodeAt(x, y).Selected := true;
      end;
      

  4.   

    RightClickSelected是不太好用,你要写MouseDown了