您的位置:首页 > 其它

TMethod的妙用:解决动态创建的组件的事件赋值问题 by LYSoft LiuYang

2005-02-01 14:28 495 查看
program Test;

uses
Windows,
SysUtils,
ExtCtrls,
Classes,
Forms;

var
timer1:TTimer; Method:TMethod;

procedure Timer1Timer(Sender: TObject);
begin
MessageBox(0, 'aa', 'bb', 0);
end;

begin
timer1:=TTimer.Create(nil);
timer1.Interval:=3000;
Method.Data := nil;
Method.Code := @Timer1Timer;
timer1.OnTimer:= TNotifyEvent(Method);
while True do Application.ProcessMessages;
end.

http://lysoft.7u7.net
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: