[英]Printing image in Rave Reports
我有一個正在Delphi 2009和Rave Reports中開發的應用程序。 我想在報告中打印一張圖像。 我將如何實施呢?
任何建議將不勝感激。
使用Draw(X,Y:Double; Graphic:TGraphic); TBaseReport后代的方法,除非要繪制位圖。 在這種情況下,請使用TBaseReport.PrintBitmap(X,Y:Double; ScaleX,ScaleY:Double;位圖:TBitmap); 或PrintBitmapRect(X1,Y1,X2,Y2:Double;位圖:TBitmap);
Draw()記錄在ms-help://embarcadero.rs2009/Rave/draw.htm中的D2009幫助文件中。
var
MyLogo: TGraphic;
begin
MyLogo := TMetafile.Create;
try
MyLogo.LoadFromFile('MYLOGO.WMF');
RvNDRWriter1.Draw(1.0,2.0,MyLogo);
finally
MyLogo.Free;
end; { tryf }
end;
您可以在Delphi 2009幫助文件中找到主題ms-help://embarcadero.rs2009/Rave/printbitmap.htm的PrintBitmap示例-該頁面上有一個PrintBitmapRect()鏈接。
// Print MyBitmap in upper left corner four times its size
RvNDRWriter1.PrintBitmap( 1.0, 1.0, 2.0, 2.0, MyBitmap );
我對Rave Reports有同樣的問題,這取決於要預覽或打印的圖像類型。 如果是WMF,則可以使用Ken White的示例:
var
MyLogo: TGraphic;
begin
MyLogo := TMetafile.Create;
try
MyLogo.LoadFromFile('MYLOGO.WMF');
RvNDRWriter1.Draw(1.0,2.0,MyLogo);
finally
MyLogo.Free;
end; { tryf }
end;
但是使用BMP時:
RvNDRWriter1.PrintBitmap( 1.0, 1.0, 2.0, 2.0, MyBitmap );
當使用JPEG圖像時:在調用RvNDRWriter1之前,必須先將JPEG轉換為BMP。
Jpeg2bmp('temp.bmp',jpegfile);
pic1.picture.loadfromfile('temp.bmp');
pic1.Visible:=true;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.