您现在的位置:首页 >> 基础算法 >> window基础 >> 内容

Delphi中如何知道一个控件有多少个事件

时间:2011/9/3 15:29:07 点击:

  核心提示:usesTypInfo; procedureTForm1.Button1Click(Sender:TObject); var I:Integer; vPropList:PPropList; vProp...

 uses   TypInfo;  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var  
      I:   Integer;  
      vPropList:   PPropList;  
      vPropInfo:   PPropInfo;  
      vText:   string;  
      vCount:   Integer;  
  begin  
      vCount   :=   0;  
      vText   :=   '';  
      for   I   :=   0   to   GetPropList(Self,   vPropList)   -   1   do  

      begin  
          vPropInfo   :=   vPropList^[I];  
          if   vPropInfo^.PropType^.Kind   =   tkMethod   then  

          begin  
              vText   :=   vText   +   vPropInfo^.Name   +   #13#10;  

              //vPropInfo^.Name是事件的名字
              Inc(vCount);  
          end;  
      end;  
      ShowMessage(vText   +   IntToStr(vCount));  
  end;  

作者:网络 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 盒子文章(www.2ccc.com) © 2024 版权所有 All Rights Reserved.
  • 沪ICP备05001939号