核心提示: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;