type TNotifyEventRef = reference to procedure(Sender: TObject); function AnonymousEvent(const Proc: TNotifyEventRef): TNotifyEvent; type TVtable = array[0..3] of Pointer; PVtable = ^TVtable; PPVtable = ^PVtable; begin TMethod(Result).Code := PPVtable((@Proc)^)^^[3]; TMethod(Result).Data := Pointer((@Proc)^); end; procedure TForm1.FormCreate(Sender: TObject); begin //变态写法 @Button1.OnClick := PPointer(Cardinal(PPointer( procedure(Sender: TObject) begin ShowMessage('你好,人民币!'); end)^) + $0C)^; //正经写法 Button2.OnClick := AnonymousEvent( procedure(Sender: TObject) begin ShowMessage('Hello,Money!'); end); end;