Treeview控件怎么判断被select的节点没有子节点,包括左键和右键选中的节点

解决方案 »

  1.   

    begin
      if treeview1.selected=nil then exit;
      if treeview1.selected.Count>0 then showmessage('有子节点');
    end;
      

  2.   

    右键
    var
      Node: TTreeNode;
    begin
      if Button = mbRight then
      begin
        Node := TreeView1.GetNodeAt(X, Y);
        if Node <> nil then 
           Node.Selected := True;
      end;
    end;
      

  3.   

    忘了,上面的在OnMouseDown里写
      

  4.   

    if treeview.selected<>nil then
      if treeview.Selected .Count>0 then
        showmessage('OK')