贫
贫烦
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;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$I Unit2.pas}
//意思为粘贴Unit2.pas的代码到这里
procedure TForm1.Button1Click(Sender: TObject);
begin
Button1.Caption := '1';
end;
end.
以下为代码文件Unit2.pas:
unit Unit2;
interface
implementation
procedure TForm1.Button2Click(Sender: TObject);
begin
Button2.Caption := '2';
end;
end.
我知道自己上面的代码有多BT,大家请不我PT
以上只是想说明我想做的,请告诉我应该怎样做才会法。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$I Unit2.pas}
//意思为粘贴Unit2.pas的代码到这里
procedure TForm1.Button1Click(Sender: TObject);
begin
Button1.Caption := '1';
end;
end.
以下为代码文件Unit2.pas:
unit Unit2;
interface
implementation
procedure TForm1.Button2Click(Sender: TObject);
begin
Button2.Caption := '2';
end;
end.
我知道自己上面的代码有多BT,大家请不我PT
以上只是想说明我想做的,请告诉我应该怎样做才会法。