试试下面的吧。怎么样?给分吧。
unit MyForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TAuditEvent=procedure (Sender:TObject;Allowed:Boolean) of Object;
TMyForm = class(TForm)
private
FAuditEvent: TAuditEvent;
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
procedure DoAudit();
property OnAuditEvent : TAuditEvent read FAuditEvent write FAuditEvent;
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TMyForm]);
end;
{ TMyForm }
procedure TMyForm.DoAudit;
begin
if Assigned(FAuditEvent) then FAuditEvent((owner as TForm),false);
end;
end.