还是给你写出来吧~~~~~.unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Edit1: TEdit; procedure Edit1KeyPress(Sender: TObject; var Key: Char); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementationuses Unit2;{$R *.dfm}procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);var ResultValue: string;begin if Key = #13 then begin ResultValue := Edit1.Text; if TForm2.Execute(ResultValue) then Edit1.Text := ResultValue; end;end;end.// Form2unit Unit2;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm2 = class(TForm) Edit2: TEdit; btnOK: TButton; btnCancel: TButton; procedure btnOKClick(Sender: TObject); private { Private declarations } public { Public declarations } // 类方法 class function Execute(var Edit2Value: string): Boolean; end;//var// Form2: TForm2;implementation{$R *.dfm}{ TForm2 }class function TForm2.Execute(var Edit2Value: string): Boolean;begin with Self.Create(nil) do try Edit2.Text := Edit2Value; // TForm1 中传过来的值 Result := (ShowModal = mrOK); // 单击的是 "确定" if Result then begin Result := not SameText(Edit2.Text, Edit2Value); if Result then // Edit2.Text 与传进来的值 Edit2Value 不同 (即有修改) Edit2Value := Edit2.Text; end; finally Free; end;end;procedure TForm2.btnOKClick(Sender: TObject);begin ModalResult := mrOK;end;end.