zoukankan      html  css  js  c++  java
  • Delphi 给frxReport赋值《lcemeaning》

    unit Unit1;
    
    interface
    
    uses
    
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, frxClass, frxDesgn;
    
    type
      TForm1 = class(TForm)
        btn1: TButton;
        frxReport1: TfrxReport;
        edt1: TEdit;
        edt2: TEdit;
        frxReport2: TfrxReport;
        btn2: TButton;
        frxDesigner1: TfrxDesigner;
        procedure frxReport2GetValue(const VarName: string; var Value: Variant);
        procedure btn1Click(Sender: TObject);
        procedure btn2Click(Sender: TObject);
        procedure frxReport2BeforePrint(Sender: TfrxReportComponent);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.btn1Click(Sender: TObject);
    begin
      frxReport2.Clear;
      frxReport2.LoadFromFile('1111.fr3');
      frxReport2.showReport;
    end;
    
    procedure TForm1.btn2Click(Sender: TObject);
    begin
      frxReport2.DesignReport;
    end;
    
    procedure TForm1.frxReport2BeforePrint(Sender: TfrxReportComponent);
    var
      memo1 : TfrxMemoView;
    begin
      //给变量赋值的第一方式
      frxReport2.Variables.Variables['EDIT1'] := QuotedStr('abc');
    
      //给控件赋值的一种方式
      Memo1 :=  frxReport2.FindObject('Memo1') as TfrxMemoView;
      memo1.Text := 'ABCDEFG';
    end;
    
    procedure TForm1.frxReport2GetValue(const VarName: string; var Value: Variant);
    begin
      //给变量赋值的第二方式
    //  if CompareText(VarName, 'edit1') = 0 then
    //    Value := edt1.Text;
    
      if CompareText(VarName, 'edit2') = 0 then
        Value := edt2.Text;
    end;
    
    end.

  • 相关阅读:
    sublime开启vim模式
    git命令行界面
    搬进Github
    【POJ 2886】Who Gets the Most Candies?
    【UVA 1451】Average
    【CodeForces 625A】Guest From the Past
    【ZOJ 3480】Duck Typing
    【POJ 3320】Jessica's Reading Problemc(尺取法)
    【HDU 1445】Ride to School
    【HDU 5578】Friendship of Frog
  • 原文地址:https://www.cnblogs.com/LceMeaning/p/3377997.html
Copyright © 2011-2022 走看看