该死的Treeview问题!!

huluobowangmeng 2004-05-10 04:37:40
弄了好久都没解决,现在请教一下大家!
tv1.GetHitTestInfoAt(x,y);它的返回值是什么呢?
GetHitTestInfoAt(x,y):Thittests;
好象应该是有htonitem、htonbutton什么的吧?!


另外tv1.GetNodeAt(x,y)好像也是不论x为何值时,只要y置正确就行。
也就是说我点击加号、节点、空白效果是一样的。都会返回y置相等的那个节点。

...全文
58 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
miky 2004-05-11
  • 打赏
  • 举报
回复
procedure TForm1.TreeView1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
AHittest:Thittests;
begin

AHittest:= TreeView1.GetHitTestInfoAt(x,y) ;
if htNoWhere in AHittest then Caption := '空白';
if htOnButton in AHittest then Caption := '+';
if htOnItem in AHittest then Caption := 'Item';
end;


Value Means the point is

htAbove Above the client area.
htBelow Below the client area.
htNowhere Inside the control, but not on an item.
htOnItem On an item, its text, or its bitmap.
htOnButton On a button.
htOnIcon On an icon.
htOnIndent On the indented area of an item.
htOnLabel On a label.
htOnRight On the right side of an item.
htOnStateIcon On a state icon or bitmap associated with an item.
htToLeft To the left of the client area.
htToRight To the right of the client area.

huluobowangmeng 2004-05-11
  • 打赏
  • 举报
回复
哦,我是想要判断奠基的是加号还是item、或是空白处!??帮帮忙吧!!
happyjoe 2004-05-11
  • 打赏
  • 举报
回复
要多看帮助,这个问题的答案帮助写的很清楚
huluobowangmeng 2004-05-11
  • 打赏
  • 举报
回复
问题解决,谢谢你的帮助!!
结贴了!
zyxg 2004-05-10
  • 打赏
  • 举报
回复
另外tv1.GetNodeAt(x,y)好像也是不论x为何值时,只要y置正确就行。
也就是说我点击加号、节点、空白效果是一样的。都会返回y置相等的那个节点。


是的 GetNodeAt(x,y) 返回的是 当你拖动时最后停留在的那个节点
huluobowangmeng 2004-05-10
  • 打赏
  • 举报
回复
55555555~~~
tanglebin 2004-05-10
  • 打赏
  • 举报
回复
up
sandyboy 2004-05-10
  • 打赏
  • 举报
回复
UP
huluobowangmeng 2004-05-10
  • 打赏
  • 举报
回复
up也有分!!

5,388

社区成员

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

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