好吧!我就不信你不给分;
gethitTestinfoat可以用在TlistView里也可以用在TTreeview里边
在Ttreeview里边,它可以确定现在你的鼠标所在的位置,也就是说,它能得到当前的坐标x,y,那么通过它,就可以反应了treeview的node了;

解决方案 »

  1.   

    Returns information about the location of a point relative to the client area of the tree view control.function GetHitTestInfoAt(X, Y: Integer): THitTests;DescriptionCall 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.exmapleThe following code checks a list of htHitTest types and adds the ones that occur when the mouse was pressed while on the tree view.procedure TForm1.TreeView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);var
      MyHitTest : THitTests;
    begin
      MyHitTest := TreeView1.GetHitTestInfoAt(X,Y);
      if htNowhere in MyHitTest then
        ListBox1.Items.Add('NoWhere');
      if htOnItem in MyHitTest then
        ListBox1.Items.Add('OnItem');
      if htOnButton in MyHitTest then
        ListBox1.Items.Add('OnButton');
      if htOnIndent in MyHitTest then
        ListBox1.Items.Add('OnIndent');  if htOnLabel in MyHitTest then
        ListBox1.Items.Add('OnLabel');
      if htOnRight in MyHitTest then
        ListBox1.Items.Add('OnRight');
    end;
      

  2.   

    错的?
    为什么,只要它点击在了右边就可以了啊;
    再者,你可以改变它的啊
    type
      THitTest = (htAbove, htBelow, htNowhere, htOnItem, htOnButton, htOnIcon,
        htOnIndent, htOnLabel, htOnRight, htOnStateIcon, htToLeft, htToRight);
      THitTests = set of THitTest;
    就是下边这些了,你可以选的,上边、下边、左边、右边都有;
      

  3.   

    我的程序的意思是只要你右击了treeview.items的右边就可以了;
    上边给你了,它的所以属性,你自己选的看吧;
      

  4.   

    ihihonline  !!!!!!!!!!!!!!!!!!!!!!eulb 是正确的