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.

  • 相关阅读:
    有个名字叫随便乱记——css3
    CSS3伸缩布局
    路政整理
    GIst
    SVN回滚版本
    你需要知道的CSS3 动画技术
    iScroll框架的使用和修改
    CSS3阴影 box-shadow的使用和技巧总结
    Javascript异步编程的4种方法
    zepto学习零碎
  • 原文地址:https://www.cnblogs.com/LceMeaning/p/3377997.html
Copyright © 2011-2022 走看看