BackPicture.Bitmap

edited 7:35AM in FastReport 4.0
I have this and works find, but I think I have memory leak

var
theFirspage : TfrxReportPage;
begin
theFirspage := TfrxReportPage(myreport.Pages[1]);
theFirspage.BackPicture.Bitmap:=TBitmap.create;
theFirspage.BackPicture.Bitmap.Width :=400;
theFirspage.BackPicture.Bitmap.height :=400;
theFirspage.BackPicture.Bitmap.canvas.Font.Color := clred;
theFirspage.BackPicture.Bitmap.canvas.Font.Size := 32;
theFirspage.BackPicture.Bitmap.Canvas.Font.Style := [fsBold];
theFirspage.BackPicture.Bitmap.canvas.TextOut(60, 80, ???WECOME???);
end;

my question is: which part I need to free to avoid memory leak?
I tried theFirspage.BackPicture.Bitmap.free
but I got error. or no need to free anything at this point

Thank you




Comments

  • gordkgordk St.Catherines On. Canada.
    edited 7:35AM
    where are you writing this code?
    you can't create the bitmap inside the report and you can't set size font or font colors.
  • Anu de DeusAnu de Deus Hampshire, UK
    edited 7:35AM
    Personally, I would do:

    var
    theFirspage : TfrxReportPage;
    MyBMP: TBitmap;
    begin
    theFirspage := TfrxReportPage(myreport.Pages[1]);
    MyBMP:=TBitmap.create;
    theFirspage.BackPicture.Bitmap:=MyBmp;

    Then AFTER you are finished with the report (after .Show), would call MyBmp.free;
  • edited 7:35AM
    nash wrote: »
    I have this and works find, but I think I have memory leak

    var
    theFirspage : TfrxReportPage;
    begin
    theFirspage := TfrxReportPage(myreport.Pages[1]);
    theFirspage.BackPicture.Bitmap:=TBitmap.create;
    theFirspage.BackPicture.Bitmap.Width :=400;
    theFirspage.BackPicture.Bitmap.height :=400;
    theFirspage.BackPicture.Bitmap.canvas.Font.Color := clred;
    theFirspage.BackPicture.Bitmap.canvas.Font.Size := 32;
    theFirspage.BackPicture.Bitmap.Canvas.Font.Style := [fsBold];
    theFirspage.BackPicture.Bitmap.canvas.TextOut(60, 80, ???WECOME???);
    end;

    my question is: which part I need to free to avoid memory leak?
    I tried theFirspage.BackPicture.Bitmap.free
    but I got error. or no need to free anything at this point

    Thank you


    I???m doing the code just after load the report from the report
    Please explain why not?
  • gordkgordk St.Catherines On. Canada.
    edited 7:35AM
    Amazed that it works it produces list index out of bounds error for me.
  • edited 7:35AM
    I have the same problem for FR318 + Delphi7 on WinXP Pro.
    help me.

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.