• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 891
  • Last Modified:

rave reports, scale a bitmap

the code below allows to print a bitmap on a report, how to force a scaling of the bitmap , to match the given area constrains ???
procedure PrintGraphicsReport(x,y , xsize, ysize  : Real; Report: TBaseReport; Filename : String);
var  Bitmap : TBitmap;
begin
  with Report do
  begin

    Bitmap := TBitmap.Create;
    try
      Bitmap.LoadFromFile(Filename);

      PrintBitmap(x,y,xsize,ysize, Bitmap);

    finally
      Bitmap.Free;
    end;

  end;
end;

Open in new window

0
BdLm
Asked:
BdLm
1 Solution
 
jimyXCommented:
You can use the "Bitmap.Canvas.StretchDraw" as follows:
procedure PrintGraphicsReport(x,y , xsize, ysize  : Real; Report: TBaseReport; Filename : String);
var  Bitmap,BM : TBitmap;
begin
  with Report do
  begin
    Bitmap := TBitmap.Create;
    BM := TBitmap.Create;
    BM.Width := xsize;
    BM.Height := ysize;
    try
      Bitmap.LoadFromFile(Filename);
      BM.Canvas.StretchDraw(x, y, xsize, ysize, Bitmap);
      PrintBitmap(x, y, xsize, ysize, BM);
    finally
      BM.Free;
      Bitmap.Free;
    end;
  end;
end;

Open in new window

0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now