L
lzc1_nuaa
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;
Edit1: TEdit;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure textout1;
procedure textout2;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.textout1;
var
i:longint;
DC:HDC;
s:string;
begin
DC:=GetDC(Form1.Handle);
for i:=0 to 10000do
begin
s:=inttostr(i);
TextOut(DC,10,10,pchar(s),length(s));
end;
ReleaseDC(Form1.Handle,DC);
end;
procedure TForm1.textout2;
var
i:longint;
DC:HDC;
s:string;
begin
DC:=GetDC(Form1.Handle);
for i:=0 to 10000do
begin
s:=inttostr(i);
textout(DC,10,80,pchar(s),length(s));
end;
ReleaseDC(Form1.Handle,DC);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:integer;
begin
edit1.Clear;
edit1.Update;
i:=strtoint(edit1.Text);
edit1.Text:=inttostr(i*i);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
thread1,thread2WORD;
begin
CreateThread(nil,0,@TForm1.textout1,nil,0,thread1);
CreateThread(nil,0,@TForm1.textout2,nil,0,thread1);
end;
end.
问题是:
CreateThread(nil,0,@TForm1.textout1,nil,0,thread1);
CreateThread(nil,0,@TForm1.textout2,nil,0,thread1);
不能编译,textout1,textout2 不是TForm1 的方法,不能由TForm1调用
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure textout1;
procedure textout2;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.textout1;
var
i:longint;
DC:HDC;
s:string;
begin
DC:=GetDC(Form1.Handle);
for i:=0 to 10000do
begin
s:=inttostr(i);
TextOut(DC,10,10,pchar(s),length(s));
end;
ReleaseDC(Form1.Handle,DC);
end;
procedure TForm1.textout2;
var
i:longint;
DC:HDC;
s:string;
begin
DC:=GetDC(Form1.Handle);
for i:=0 to 10000do
begin
s:=inttostr(i);
textout(DC,10,80,pchar(s),length(s));
end;
ReleaseDC(Form1.Handle,DC);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:integer;
begin
edit1.Clear;
edit1.Update;
i:=strtoint(edit1.Text);
edit1.Text:=inttostr(i*i);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
thread1,thread2WORD;
begin
CreateThread(nil,0,@TForm1.textout1,nil,0,thread1);
CreateThread(nil,0,@TForm1.textout2,nil,0,thread1);
end;
end.
问题是:
CreateThread(nil,0,@TForm1.textout1,nil,0,thread1);
CreateThread(nil,0,@TForm1.textout2,nil,0,thread1);
不能编译,textout1,textout2 不是TForm1 的方法,不能由TForm1调用