如题!

解决方案 »

  1.   

    参考
    var
      Form1: TForm1;
      Count :Integer;
    implementation{$R *.dfm}{ TForm1 }procedure TForm1.vPrint;
    var
      QRL : TQRLabel;
      I, J , K :integer;
      xLeft, xTop, xHeight, xWidth :Integer;
      QRLName : String;
    begin
      K :=0;
      xLeft := 24;
      xTop := 184;
      xHeight :=17;
      xWidth :=665;
      QRMemo1.Visible :=False;
      QRLabel1.Visible :=False;
      for I := 0 to QRMemo1.Lines.Count - 1 do
      begin
        if ((xTop + 17 * I + 8) > 995 ) then Break; //判断是否越界
        QRLName := 'QRL'+ IntToStr(I+1);//这是名子,可要可不要;
        QRL := TQRLabel.Create(self);
        QRL.AutoSize :=False;
        QRL.Parent := QRLabel1.Parent;// PageHeaderBand1;
        QRL.Left := xLeft ;;
        QRL.Top := xTop + 17 * I + 8;
        QRL.Height := xHeight;
        QRL.Width := xWidth;
        QRL.Name := QRLName;
        QRL.Caption := QRMemo1.Lines.Strings[I];
        QRL.Visible := True;
      end;
      if I <= QRMemo1.Lines.Count  then
      begin
        Count := I;
        xTop := 48;
        Form3.QRLabel1.Caption := '自我简介续页';
        for J := I to QRMemo1.Lines.Count - 1 do
        begin
          QRLName := 'QRL'+ IntToStr(J+4);
          QRL := TQRLabel.Create(self);
          QRL.AutoSize :=False;
          QRL.Parent := Form3.QRLabel1.Parent;// PageHeaderBand1;
          QRL.Left := xLeft ;
          QRL.Top := xTop + 17 * K + 8;
          K := K + 1;
          QRL.Height := xHeight;
          QRL.Width := xWidth;
          QRL.Name := QRLName;
          QRL.Caption := QRMemo1.Lines.Strings[J];
          QRL.Visible := True;
        end;
      end;
    end;
    ---------------------------------
    var
      Form2: TForm2;implementation{$R *.dfm}procedure TForm2.Button1Click(Sender: TObject);
    begin
      Form1.QRMemo1.Lines := Memo1.Lines;
      Form1.vPrint;
      QRCompositeReport1.Preview;
      Application.MessageBox('敌方全部被歼灭','GAME OVER',mb_ok+mb_iconinformation);
    end;procedure TForm2.Button2Click(Sender: TObject);
    begin
      Label1.Caption :=IntToStr(Memo1.Lines.Capacity);
    end;procedure TForm2.QRCompositeReport1AddReports(Sender: TObject);
    begin
      if Count < Memo1.Lines.Count-1 then
      begin
        QRCompositeReport1.Reports.Add(Form1.QuickRep1);
        QRCompositeReport1.Reports.Add(Form3.QuickRep1);
      end else
        QRCompositeReport1.Reports.Add(Form1.QuickRep1);
    end;
    ----------------------------------------------
    var
      Form3: TForm3;implementation{$R *.dfm}end.