BackPicture.Bitmap

edited 10:30PM 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 10:30PM
    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 10:30PM
    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 10:30PM
    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 10:30PM
    Amazed that it works it produces list index out of bounds error for me.
  • edited 10:30PM
    I have the same problem for FR318 + Delphi7 on WinXP Pro.
    help me.

Leave a Comment