PageHeader.fil.BackColor

creation report in delphi code, how to change the color BackColor of PageHeader, I can not find the property: PageHeader.fil.BackColor

Thank you for your help

Comments

  • PolomintPolomint Australia
    edited 1:50PM
    gpiriou wrote: »
    PageHeader.fil.BackColor
    I assume you meant PageHeader.Fill.BackColor. This works as required in version FastReport 5.0 and 6.0, but I can't test it on 4.0...

    Cheers, Paul
  • edited 1:50PM
    hi
    sorry I was gone on vacation ...
    it does not work with FR6.
    LPageHeader1.Fill.backcolor: undeclared identifier
  • PolomintPolomint Australia
    edited March 2018
    gpiriou wrote: »
    LPageHeader1.Fill.backcolor: undeclared identifier
    Hope you had a good time on holiday [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> (Bearing in mind that I am looking at FR VCL 6.0 here...) I decided to demonstrate how to do this, with the following code, only to get your error(!) i.e.[/img]
    [dcc32 Error] TestFastReportVariablesForm.pas(32): E2003 Undeclared identifier: 'BackColor'
    unit TestFastReportVariablesForm;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, frxClass;
    
    type
      TFormTestFastReportVariables = class(TForm)
        PanelMain : TPanel;
        ButtonPreview : TButton;
        Report : TfrxReport;
        procedure ReportBeforePrint (Sender : TfrxReportComponent);
        procedure ReportBeginDoc(Sender: TObject);
      private
        { Private declarations }
        LPageHeader1 : TfrxPageHeader;
      public
        { Public declarations }
      end; {TFormTestFastReportVariables}
    
    var
      FormTestFastReportVariables : TFormTestFastReportVariables;
    
    implementation
    
    {$R *.dfm}
    
    procedure TFormTestFastReportVariables.ReportBeforePrint (Sender : TfrxReportComponent);
    begin
      LPageHeader1.Fill.BackColor := clSkyBlue;
    end; {TFormTestFastReportVariables.ReportBeforePrint}
    
    procedure TFormTestFastReportVariables.ReportBeginDoc (Sender : TObject);
    begin
      LPageHeader1 := Report.FindObject ('LPageHeader1') as TfrxPageHeader;
    end; {TFormTestFastReportVariables.ReportBeginDoc}
    
    end.
    
    So while you can set the Fill BackColor in the designer, and store the value in the DFM / FR3 file, it seems you can't set it in Delphi code!

    Now this is strange, because a look at the FR VCL 5.6.8 source shows the declaration of TfrxCustomFill does publish BackColor:
      TfrxCustomFill = class(TPersistent)
      public
    //    procedure Assign(Source: TfrxCustomFill); virtual; abstract;
        procedure Draw(ACanvas: TCanvas; X, Y, X1, Y1: Integer; ScaleX, ScaleY: Extended); virtual; abstract;
        function Diff(AFill: TfrxCustomFill; const Add: String): String; virtual; abstract;
      end;
    
      TfrxBrushFill = class(TfrxCustomFill)
      private
        FBackColor: TColor;
        FForeColor: TColor;
        FStyle: TBrushStyle;
      public
        constructor Create;
        procedure Assign(Source: TPersistent); override;
        procedure Draw(ACanvas: TCanvas; X, Y, X1, Y1: Integer; ScaleX, ScaleY: Extended); override;
        function Diff(AFill: TfrxCustomFill; const Add: String): String; override;
      published
        property BackColor: TColor read FBackColor write FBackColor default clNone;
        property ForeColor: TColor read FForeColor write FForeColor default clBlack;
        property Style: TBrushStyle read FStyle write FStyle default bsSolid;
      end;
    

    More investigation is needed here, but I've run out of time today!

    Cheers, Paul
    ==============================

    Reading my post I just spotted a blooper! TfrxCustomFill does not publish BackColor, TfrxBrushFill (a descendant) does!

    As a workaround you could do:
      TfrxBrushFill (LPageHeader1.Fill).BackColor := clSkyBlue;
    
    which in my test program works!

    I think this is something you should raise with Support.

    Cheers, Paul
  • edited 1:50PM
    Hello,

    TfrxBrushFill (LPageHeader1.Fill) .Backcolor: = $ 00CCFFCC;

    super it works!

    thank you very much. see you soon

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.