(接上文)
组件的代码由于假设你已经熟悉delphi开发(它和一般开发没什么不同),我们就直接贴出来并加上适当的注释:
unit clock;
interface
uses
sysutils, classes, controls, stdctrls,extctrls;
type
tstate=(stclock,strunclock,stbackclock);//定义枚举类表示控件的3种状态:时钟、跑表、倒计时钟
tclock = class(tcustomlabel)
private
fstate:tstate;
ftimer:ttimer;//为什么使用这个组件作为我们组件的私有成员就不用说了吧
rcd:array[1..8] of integer;//跑表中的各个数位。