delphi label.caption显示不出来

2024-11-02 12:28:51
推荐回答(2个)
回答1:

下面是我的测试程序,可以正常运行:

仅在Form上放一个Timer和Label。

试着重新放一个新的label,不修改任何属性

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
var
XQ:string;
begin
DateTimeToString(XQ,'ddd',date); //XQ是string,代表星期
Label1.Caption:='现在是'+DateTimeToStr(Now) + XQ;
end;

end.

回答2:

Timer1.enable:=true;