C
cooldren
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
showmessage(inttostr(add(2,3));
end;
end.
unit Unit2;
interface
implementation
function Add(i,j:integer):integer;
begin
result:=i+j;
end;
end.
怎么调用Unit2中的Add呀?
谢谢!
如
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
showmessage(inttostr(add(2,3));
end;
end.
unit Unit2;
interface
implementation
function Add(i,j:integer):integer;
begin
result:=i+j;
end;
end.
怎么调用Unit2中的Add呀?
谢谢!