如何“继承”固有控件的事件?(50分)

  • 主题发起人 主题发起人 zLight
  • 开始时间 开始时间
Z

zLight

Unregistered / Unconfirmed
GUEST, unregistred user!
全文检索 好象暂时不能用!?
我想在一个我自己的对象里包含Delphi已有的VCL控件,使用什么方法能继承(也许不叫继承)被包含控件的原有事件? 应该没什么难度我想,刚深入研究OOP,所以请大家多帮忙!谢谢……
比如,我随便写一个对象,把Timer控件包进去,但是,我该怎么做才能象在原始的窗体中直接使用Timer控件一样,设置其属性就可以定时循环触发Timer的时间,以便循环执行我自己的代码?
 
[:D] 自己顶一下,一会到公司再上来结贴哦……
 
TYourClass=Class(TComponent)
private
FTime:TTime;
procedure Timer(Sender: TObject);
public
constructor Create;
end;
constructor TYourClass.Create;
begin
Inherited;
FTime:=TTimer.Create;
FTime.OnTime:=Timer;//事件
end;

procedure TYourClass.Timer(Sender: TObject);
begin

end;

end.

 
大富翁全文检索:http://24.112.80.254/index.html 自己查吧!
 
璋㈣阿鍚勪綅鈥︹
 
后退
顶部