本帖最后由 leisure520 于 2013-07-06 16:19:48 编辑

解决方案 »

  1.   

    在主窗口调用 txtform.memotxt.text:=('dsads')  这么写没任何问题.主单元
    unit Unit15;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, cxGroupBox, StdCtrls, Unit16;type
      TForm15 = class(TForm)
        btn1: TButton;
        cxgrpbx1: TcxGroupBox;
        procedure btn1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
        txtform : Ttxtform;
      public
        { Public declarations }
      end;var
      Form15: TForm15;implementation{$R *.dfm}procedure TForm15.btn1Click(Sender: TObject);
    begin
      txtform.mmo1.Text:= ('dsads')
    end;procedure TForm15.FormCreate(Sender: TObject);
    begin
      txtform:= Ttxtform.Create(cxgrpbx1,self);
      txtform.BorderStyle := bsNone;
      txtform.WindowState := wsMaximized;
      txtform.Parent := cxgrpbx1;
      txtform.Show;
    end;end.
    被调用单元
    unit Unit16;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      Ttxtform = class(TForm)
        mmo1: TMemo;
        btn1: TButton;
        procedure btn1Click(Sender: TObject);
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
      private
        { Private declarations }
        FOwnerForm : TForm;
      public
        { Public declarations }
        constructor Create(AOwner: TComponent; OwnerForm: TForm ); reintroduce;//声明调用函数
      end;var
      txtform: Ttxtform;implementation{$R *.dfm}procedure Ttxtform.btn1Click(Sender: TObject);
    begin
      mmo1.Text:= 'ff' ;
    end;constructor Ttxtform.Create(AOwner: TComponent; OwnerForm: TForm);
    begin
      inherited Create(Aowner);
      FOwnerForm := OwnerForm;
    //  ComboBox1.Items := Screen.Fonts;
    //  ComboBox1.SelText := memotxt.Font.Name;
    end;procedure Ttxtform.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      Action := caFree
    end;end.