TfrxPictureView don't accept different PNG's anymore
Hi,
In FastReport v4 I used to fill TfrxPictureView with a TClientDataset-field from a database which contains a PNG-picture. In FastReport v5.3 and v5.3.14 this don't work anymore.
In frxReport.OnManualBuild :
OR in frxReport.OnBeforePrint :
You can add a PNG in the TfxrPictureView.Picture property, but if you want to use different PNG-pictures for each report that's no option, so this has te be done the way I did it before or to define a frxDBDataSet to the property TfrxPictureView.DataSet and the field to TfrxPictureView.DataField.
All possibilities mentioned above work fine in v4 but in not v5 with PNG's, just (a.f.a.i.k.) JPG's.
How can I solve this problem ?
[Edit]
I think it has something to do with recognising with the defined const in frxClass.pas of OriginalPNGHeader
When compiling I get a warning: "frxClass(7517: W1061 Narrowing given WideChar constant (#$0089) to AnsiChar lost information" so I guess the header of the PNG-picture isn't recognized as a PNG because of #137 ....
[/Edit]
In FastReport v4 I used to fill TfrxPictureView with a TClientDataset-field from a database which contains a PNG-picture. In FastReport v5.3 and v5.3.14 this don't work anymore.
In frxReport.OnManualBuild :
Pict := MyReport.FindObject('Picture1') as TfrxPictureView;
if (Pict <> nil) then
begin
  MS := TMemoryStream.Create;
  try
    cdsLookupConfigLOGO_RAPPORT.SaveToStream(MS);
    Pict.LoadPictureFromStream(MS);
  finally
    MS.Free;
  end;
end;
OR in frxReport.OnBeforePrint :
if Sender.Name = 'Picture1' then
begin
  MS := TMemoryStream.Create;
  try
    cdsLookupConfigLOGO_RAPPORT.SaveToStream(MS);
    TfrxPictureView(Sender).LoadPictureFromStream(MS);
  finally
    MS.Free;
  end;
end;
You can add a PNG in the TfxrPictureView.Picture property, but if you want to use different PNG-pictures for each report that's no option, so this has te be done the way I did it before or to define a frxDBDataSet to the property TfrxPictureView.DataSet and the field to TfrxPictureView.DataField.
All possibilities mentioned above work fine in v4 but in not v5 with PNG's, just (a.f.a.i.k.) JPG's.
How can I solve this problem ?
[Edit]
I think it has something to do with recognising with the defined const in frxClass.pas of OriginalPNGHeader
const
  OriginalPngHeader: array[0..7] of AnsiChar = (#137, #80, #78, #71, #13, #10, #26, #10);
When compiling I get a warning: "frxClass(7517: W1061 Narrowing given WideChar constant (#$0089) to AnsiChar lost information" so I guess the header of the PNG-picture isn't recognized as a PNG because of #137 ....
[/Edit]
Comments
I left the var PNGHeader its original size.
And in TfrxPictureView.LoadPictureFromStream
Somebody knows a better solution ?