P
p-popo
Unregistered / Unconfirmed
GUEST, unregistred user!
我在程序中调用一个过程来改变Label1的Caption属性。
程序可以执行,但Label1的Caption属性没有改变,请问是什么问题啊。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure change;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ TForm1 }
procedure TForm1.change;
var frm:TForm1;
begin
frm:=TForm1.Create(Application);
frm.Label1.Caption:='fadsfdasadfs';
ShowMessage('aaaaaaa')
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
form1.change;
form1.Label1.Refresh;
end;
end.
程序运行时按下Button1后,出现showmessage窗口,Label1的Caption属性未改变。
程序可以执行,但Label1的Caption属性没有改变,请问是什么问题啊。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure change;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ TForm1 }
procedure TForm1.change;
var frm:TForm1;
begin
frm:=TForm1.Create(Application);
frm.Label1.Caption:='fadsfdasadfs';
ShowMessage('aaaaaaa')
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
form1.change;
form1.Label1.Refresh;
end;
end.
程序运行时按下Button1后,出现showmessage窗口,Label1的Caption属性未改变。