※
※快乐点滴※
Unregistered / Unconfirmed
GUEST, unregistred user!
各位富翁,小的我是一个初学者,有好些富翁们看起来是非常小的问题,但对我来说好像是个大总是一样,现有一个小小的问题请问大家,
请给我改正一下,先谢谢了哈!
问题是这样的:我想做个在窗体是显示运行时间,代码如下:
unit main_;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ExtCtrls;
type
Tmain = class(TForm)
StatusBar1: TStatusBar;
runtime: TTimer;
procedure runtimeTimer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
main: Tmain;
implementation
type
week=(Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday)
//定义//开始写的代码的到结束哈
{$R *.dfm}
function mday(day:week):string;
begin
case day of
Monday:mday:='星期一';
Tuesday:mday:='星期二';
Wednesday:mday:='星期三';
Thursday:mday:='星期四';
Friday:mday:='星期五';
Saturday:mday:='星期六';
Sunday:mday:='星期日';
end;
end;
procedure Tmain.runtimeTimer(Sender: TObject);
var
runtime,TT:string;
day:week;
n:integer;
begin
n:=dayofweek(now);
case n of
1:day:=Monday;
2:day:=Tuesday;
3:day:=Wednesday;
4:day:=Thursday;
5:day:=Friday;
6:day:=Saturday;
7:day:=Sunday;
end;
TT:=mday(day);
runtime:='运行时间:'+datetostr(date)+' '+TT+' '+timetostr(time);
main.statusbar1.panels[1].text:=runtime;
end;
procedure Tmain.FormCreate(Sender: TObject);
begin
runtime.Enabled:=true;
end;
end.
窗体上只有一个timer和一个status
没什么大错,谅给了我一个警告:[Warning] main_.pas(56): Variable 'day' might not have been initialized
我不知道是怎么回事,请各位富翁给我解答一下,再次先谢谢了哈。
请给我改正一下,先谢谢了哈!
问题是这样的:我想做个在窗体是显示运行时间,代码如下:
unit main_;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ExtCtrls;
type
Tmain = class(TForm)
StatusBar1: TStatusBar;
runtime: TTimer;
procedure runtimeTimer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
main: Tmain;
implementation
type
week=(Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday)
//定义//开始写的代码的到结束哈
{$R *.dfm}
function mday(day:week):string;
begin
case day of
Monday:mday:='星期一';
Tuesday:mday:='星期二';
Wednesday:mday:='星期三';
Thursday:mday:='星期四';
Friday:mday:='星期五';
Saturday:mday:='星期六';
Sunday:mday:='星期日';
end;
end;
procedure Tmain.runtimeTimer(Sender: TObject);
var
runtime,TT:string;
day:week;
n:integer;
begin
n:=dayofweek(now);
case n of
1:day:=Monday;
2:day:=Tuesday;
3:day:=Wednesday;
4:day:=Thursday;
5:day:=Friday;
6:day:=Saturday;
7:day:=Sunday;
end;
TT:=mday(day);
runtime:='运行时间:'+datetostr(date)+' '+TT+' '+timetostr(time);
main.statusbar1.panels[1].text:=runtime;
end;
procedure Tmain.FormCreate(Sender: TObject);
begin
runtime.Enabled:=true;
end;
end.
窗体上只有一个timer和一个status
没什么大错,谅给了我一个警告:[Warning] main_.pas(56): Variable 'day' might not have been initialized
我不知道是怎么回事,请各位富翁给我解答一下,再次先谢谢了哈。