我想做一个自定义控件,在panel显示时间,设定闹钟的。下面是参考书上的一点代码:
unit Clock;interfaceuses
SysUtils, Classes, Controls, ExtCtrls;type
Clock = class(TPanel)
private
{ Private declarations }
Timer1:TTimer; //时间控件
Factive:Boolean; //时钟控件是否处于激活状态
FBeep:Boolean; //是否报时
Fnow:TDateTime; //存放当前时间
procedure CheckBeep;
protected
{ Protected declarations }
procedure TimeOn(sender:TObject); //处理的方法程序
public
{ Public declarations }
constructor Create(Owner:TComponent); //构造方法
destructor destory;override; //构析方法
published
{ Published declarations }
property Active:Boolean read Factive write Factive; //激活时间
property Beep:Boolean read Fbeep write FBeep; //激活闹钟
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('Samples', [Clock]);
end;{ Clock }procedure Clock.CheckBeep;
var h,m,s,ss:word;
begin
DecodeTime(now,h,m,s,ss); //用函数decode()取时、分、秒、毫秒
if (h=0 and m=0 and s=0)or(m=59 and 60>=s+h) then
begin
asm mov ax 0e07h
int 10h;
end;
end;
end;constructor Clock.Create(Owner: TComponent);
begin
inherited Create(owner); 有问题???????
parent:=Aowner as tWinControl; 有问题???????
timer:=TTimer.create(self); 有问题???????end;在上面的代码中:
inherited Create(owner); 有问题???????
parent:=Aowner as tWinControl; 有问题???????
timer:=TTimer.create(self); 有问题???????
1、前两行是什么意思啊?
2、为什么在输入inherited create然后按ctrl+enter时却没有我create的提示出来?
3、在第二行和第三行也出现ctrl+enter时却没有找一关键字的内容,如time时按ctrl+enter后却没有出现上面定义的timer啊?请高手帮忙上面三个问题。TKS!
unit Clock;interfaceuses
SysUtils, Classes, Controls, ExtCtrls;type
Clock = class(TPanel)
private
{ Private declarations }
Timer1:TTimer; //时间控件
Factive:Boolean; //时钟控件是否处于激活状态
FBeep:Boolean; //是否报时
Fnow:TDateTime; //存放当前时间
procedure CheckBeep;
protected
{ Protected declarations }
procedure TimeOn(sender:TObject); //处理的方法程序
public
{ Public declarations }
constructor Create(Owner:TComponent); //构造方法
destructor destory;override; //构析方法
published
{ Published declarations }
property Active:Boolean read Factive write Factive; //激活时间
property Beep:Boolean read Fbeep write FBeep; //激活闹钟
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('Samples', [Clock]);
end;{ Clock }procedure Clock.CheckBeep;
var h,m,s,ss:word;
begin
DecodeTime(now,h,m,s,ss); //用函数decode()取时、分、秒、毫秒
if (h=0 and m=0 and s=0)or(m=59 and 60>=s+h) then
begin
asm mov ax 0e07h
int 10h;
end;
end;
end;constructor Clock.Create(Owner: TComponent);
begin
inherited Create(owner); 有问题???????
parent:=Aowner as tWinControl; 有问题???????
timer:=TTimer.create(self); 有问题???????end;在上面的代码中:
inherited Create(owner); 有问题???????
parent:=Aowner as tWinControl; 有问题???????
timer:=TTimer.create(self); 有问题???????
1、前两行是什么意思啊?
2、为什么在输入inherited create然后按ctrl+enter时却没有我create的提示出来?
3、在第二行和第三行也出现ctrl+enter时却没有找一关键字的内容,如time时按ctrl+enter后却没有出现上面定义的timer啊?请高手帮忙上面三个问题。TKS!
解决方案 »
- 高手请赐教 delphi quickreport 分组报表应该怎么实现?
- 刚学delphi,在tpagecontrol容器中,怎样放置一个listview?
- 求有控制条码打印机和条码扫描枪相关的资料代码?
- 如何用PostMessage,参数为LParamHi,, LParamLo,, WParamHi,,WparamLo
- quickreport的问题
- SQL语句 count(MAX(***) 出错了
- 在使用BDE连接远端服务器时出现错误:Cannot load and IDAPI service libraay.?up有分!
- 请问怎样改变数据库时间的格式(就这些分了,大家别嫌弃)
- 在DELPHI中,如何实现服务器传输文件到客户端?
- 很怪的一个问题!
- 这里有vc,vb,java,delphi源代码大全,国内和国外的经典软件代码请访问www.feidu.net
- Treeview搞不定的问题。
parent:=Aowner as tWinControl; 设置他的parent位Aowner,不过好像你写错了吧.
这个提示不一定都有的,正常.
为什么要用Aowner呢?
parent:=Aowner as tWinControl; 去掉!!!
timer:=TTimer.create(self); 没有问题