如题,我做了个简单的例子,在第一次点击 + 时,肯定会触发OnChange事件,然后再次点击无数次都不会触发,这是什么原因,我怎么才能实现如标题中说的那样

解决方案 »

  1.   

    可以处理OnMouseDown事件,利用这个事件中的x,y坐标获取点击的节点。
    用TTreeView.GetNodeAt方法。
      

  2.   

    在点击+时,GetNodeAt返回不为空,也是当前+后面的节点啊,没法处理啊
      

  3.   

    不是吧,点击+时不出发OnChange事件的!
      

  4.   

    点击+时并没有选择任何节点啊,当然不会响应OnChange事件了。
      

  5.   

    Harryfin说的没错,+也是节点的一部分,点击+也会触发onChange时间,大家可以做个例子试试
      

  6.   

    点击加号,Expanding事件在OnChange事件之前,所以做一个变量,你在Expanding中设置变量,在OnChange中判断此变量的值,来决定是否来自点击加号
      

  7.   

    GetHitTestInfoAt method (TCustomTreeView)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.