//最重要的时间函数,用于调用该类的事件触发高度函数。
//以及在容器中显示计数值
procedure ttimecount.ftimertimer(sender:tobject);
begin
inc(fcount);
if (fcount mod 3600)=0 then fcount:=0;
caption:=inttostr(fcount);//这个就是显示计数值
inc(timenum);
if (timenum=timelen)and(factive) then
begin
dotimeout;
timenum:=0;
end;
end;
//事件调度函数,将外部的事件处理函数和该类的事件方法指针联系起来
procedure ttimecount.dotimeout;
begin
if assigned(ftimeout) then
ftimeout(self);
end;
end.
五,组件注册安装与删除。
组件类编写完毕,接着就要测试了,这个从略,可以在刚才的工程中动态创建它,设置相应属性,指定时间事件,看看是否正确。上面是经过测试的。
到确定正确后,就要来看看装组件的步骤了: