onclick
if Leave = I then
begin
  //
end;

解决方案 »

  1.   

    错啦,错啦,这样吧
    OnClick事件里进行判断,看它是展开还是点叶子结点;
    if TreeView1.Selected.Level = I then
    begin
    end;
      

  2.   

    不行的,你选中的level在onclick中照样执行啊??
    我的意思是我在onclick中做的事件不要被Expanding事件响应,,明白吗?
      

  3.   

    重载 
    procedure CNNotify(var Message: TWMNotify);override
    begin
      if message.NMHdr^.code=TVN_ITEMEXPANDING then
      begin
        if .. then
          dispath(message);
        inherited(message);
      end; 
    end;
      

  4.   

    在程序中
    TreeView.OnClick:=nil
    .....
    TreeView.OnCLick:=TreeViewClick;
      

  5.   

    Expanding事件中获得当前的位置,看它是不是展开的位置,要不然就不执行了;