delphi 我想在一个方法里边修改窗体上LABEL的caption,结果这样不行,请问怎样改?
unitUnit1;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,F...
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Label1: TLabel;
implementation
{$R *.dfm}
function a:Boolean;
begin
ShowMessage('');//这个可以生效
Label1.Caption:='1234';//无法生效
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
unit1.a;
end;
end. 展开
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Label1: TLabel;
implementation
{$R *.dfm}
function a:Boolean;
begin
ShowMessage('');//这个可以生效
Label1.Caption:='1234';//无法生效
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
unit1.a;
end;
end. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询