在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
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;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论