弄了好久都没解决,现在请教一下大家!
tv1.GetHitTestInfoAt(x,y);它的返回值是什么呢?
GetHitTestInfoAt(x,y):Thittests;
好象应该是有htonitem、htonbutton什么的吧?!
另外tv1.GetNodeAt(x,y)好像也是不论x为何值时,只要y置正确就行。
也就是说我点击加号、节点、空白效果是一样的。都会返回y置相等的那个节点。

解决方案 »

  1.   

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

  2.   

    哦,我是想要判断奠基的是加号还是item、或是空白处!??帮帮忙吧!!
      

  3.   

    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 ishtAbove          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.