如何拖动Treeview的子节点到任意父节点?

lishen 2001-12-11 06:43:05
如何拖动Treeview的子节点到任意父节点,就是类似与资源管理器的文件拖动?
...全文
119 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
rtewryery 2001-12-11
  • 打赏
  • 举报
回复
Returns information about the location of a point relative to the client area of the tree view control.

function GetHitTestInfoAt(X, Y: Integer): THitTests;

Description

Call GetHitTestInfoAt to determine what portion of the tree view, if any, sits under the point specified by the X and Y parameters. For example, use GetHitTestInfoAt to provide feedback about how to expand or collapse nodes when the mouse is over the relevant portions of the tree view.

GetHitTestInfo returns a THitTests type. This set describes the possible tree view elements under the mouse.
ccbxnzhwj 2001-12-11
  • 打赏
  • 举报
回复
GetHitTestInfoAt的用处是什么?
Apollo47 2001-12-11
  • 打赏
  • 举报
回复
这其实是Delphi帮助的例子。查找帮助TTreeView.GetNodeAt()。
ihihonline 2001-12-11
  • 打赏
  • 举报
回复
to zswang(伴水)(伤心中) 
你真不简单呀,我如果不在机子旁边,什么也不记了,哈哈,嗯
给个联系方式好不好?
QQ 21713137
王集鹄 2001-12-11
  • 打赏
  • 举报
回复
//The following code uses GetNodeAt to add a dragged node as a child of the node under then mouse when it is dropped.

procedure TForm1.TreeView1DragDrop(Sender, Source: TObject; X, Y: Integer);

var
AnItem: TTreeNode;
AttachMode: TNodeAttachMode;
HT: THitTests;
begin
if TreeView1.Selected = nilthen Exit;
HT := TreeView1.GetHitTestInfoAt(X, Y);
AnItem := TreeView1.GetNodeAt(X, Y);
if (HT - [htOnItem, htOnIcon, htNowhere, htOnIndent] <> HT) then
begin
if (htOnItem in HT) or (htOnIcon in HT) then AttachMode := naAddChild
else if htNowhere in HT then AttachMode := naAdd

else if htOnIndent in HT then AttachMode := naInsert;
TreeView1.Selected.MoveTo(AnItem, AttachMode);
end;
end;
ihihonline 2001-12-11
  • 打赏
  • 举报
回复
我记得它有一个select....什么来的,
哎,笨一点的话,就是选中的这个删除掉,在上边再一个

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧