delphi中有带多选框的目录树形控件吗
1个回答
2017-12-31 · 知道合伙人数码行家
huanglenzhi
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:117538
获赞数:517183
长期从事计算机组装,维护,网络组建及管理。对计算机硬件、操作系统安装、典型网络设备具有详细认知。
向TA提问 私信TA
关注
展开全部
在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;
参照下面的代码为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;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询