好友
阅读权限40
听众
最后登录1970-1-1
|
unit Unit7;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.StdCtrls;
type
TForm7 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form7: TForm7;
function goushi(i: Integer):integer; //定义公共函数
implementation
uses
Unit8;
function goushi(i: Integer):integer;
begin
Form7.Edit1.text := 8.toString; //form2调运Form1的函数,如需要用到form1的组件,应注意在组件前添fORM1
end;
{$R *.dfm}
procedure TForm7.Button1Click(Sender: TObject);
begin
Form8.Show;
end;
end.
unit Unit8;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.StdCtrls;
type
TForm8 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form8: TForm8;
implementation
uses
Unit7;
{$R *.dfm}
procedure TForm8.Button1Click(Sender: TObject);
var
i: Integer;
begin
i := 5;
Edit1.Text := '2';
goushi(i);
ShowMessage(IntToStr(goushi(i)));
end;
end. |
免费评分
-
查看全部评分
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|