delphi中有带多选框的目录树形控件吗?
如没有,谁知道该如何实现?

解决方案 »

  1.   

    treeview怎末实现这个功能?
      

  2.   

    在TreeView的StateImags中为其指定一个ImageList控件放入选中,不选中的图标然后
    参照下面的代码为TreeView的MouseDown事件//状态图标选中和非选中状态的索引
    Const
      Img_Select = 5 ;
      Img_NoSelect = 4 ;
      
    procedure TFrmPermission.tvPermissionMouseDown(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    var Node:TTreeNode;
      TopRight, BottomLeft: TPoint;
    begin
      Node:=tvPermission.GetNodeAt(x,y);
      if Node<>nil then
      begin
        TopRight:=Node.DisplayRect(True).TopLeft;
        BottomLeft :=Node.DisPlayRect(True).BottomRight;
        //判断是否在Check图标范围内
        if (X >= TopRight.X - 15) and (X <= BottomLeft.X - 21) and (Y >= TopRight.Y) and (Y <= BottomLeft.Y) then
        begin
          with Node do
          begin
            if ((StateIndex=Img_Select) )  then
              StateIndex:=Img_NoSelect
            else
              if ((StateIndex=Img_NoSelect) ) then
                StateIndex:=Img_Select;
          end;
        end;
      end;
    end;
      

  3.   

    用1stClass控件的fcTreeView或fcDBTreeView就可以了,将MultiSelectAttributes的Enabled设为True,所有项目都会有复选框。
      

  4.   

    kuan
    你说的控件在那能找到呀?