P
pcanywhere
Unregistered / Unconfirmed
GUEST, unregistred user!
程序如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
testthread.Create(false);
end;
end.
--------------------------------------------------------------------
unit Unit2;
interface
uses
Classes,SysUtils;
type
testthread = class(TThread)
private
procedure test;
{ Private declarations }
protected
procedure Execute;
override;
end;
implementation
uses unit1;
{ testthread }
procedure testthread.Execute;
begin
Synchronize(test);
end;
procedure testthread.test;
var
i:integer;
begin
for i:=0 to 10000do
form1.caption:=inttostr(i);
end;
end.
--------------------------------------------------------
为何在程序运行的时候,我同时去移动窗体,程序没有响应,不能移动,
直到运行结束,应该怎样做??谢谢
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
testthread.Create(false);
end;
end.
--------------------------------------------------------------------
unit Unit2;
interface
uses
Classes,SysUtils;
type
testthread = class(TThread)
private
procedure test;
{ Private declarations }
protected
procedure Execute;
override;
end;
implementation
uses unit1;
{ testthread }
procedure testthread.Execute;
begin
Synchronize(test);
end;
procedure testthread.test;
var
i:integer;
begin
for i:=0 to 10000do
form1.caption:=inttostr(i);
end;
end.
--------------------------------------------------------
为何在程序运行的时候,我同时去移动窗体,程序没有响应,不能移动,
直到运行结束,应该怎样做??谢谢