用QuickReport打印一张图片,希望按照用户设定纸的大小,动态调整图片比例,适应纸的大小。有好办法吗? 图片放在qrimage中的,您有别的办法也行。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自己解决了,没用qrimage,用TPrinter自己写的。主要代码来源于大富翁上以前的贴子,图片文件格式为wmf(图元文件)自己加的: Image1.Picture.Graphic.Height:=Hei; Image1.Picture.Graphic.Width:=Wid;这两句十分重要。限于兄弟们分享如下: procedure TFpms_make_table.SpeedButton4Click(Sender: TObject);var Ratio,Ratio1,Ratio2:Double; wid,hei,X,Y:integer; DestRect: TRect;begin if Image1.Picture=NIL then exit;//************************************************************* //按照纸张大小伸缩打印************** Add by cjf 2003-6-23 if not PageSetupDialog1.Execute then exit; Ratio1 := Printer.PageWidth / Image1.Width; //Ratio1: Double Ratio2 := Printer.PageHeight / Image1.Height; //Ratio2: Double if Ratio1 < Ratio2 then Ratio := Ratio1 //Ratio: Double else Ratio := Ratio2; Wid := Round(Ratio * Image1.Width); //Wid: Integer Hei := Round(Ratio * Image1.Height); //Hei: Integer X := (Printer.PageWidth - Wid) shr 1; //X: Integer Y := (Printer.PageHeight - Hei) shr 1; //Y: Integer DestRect := Rect(X, Y, X + Wid, Y + Hei); //DestRect: TRect Image1.Picture.Graphic.Height:=Hei; Image1.Picture.Graphic.Width:=Wid; try Printer.BeginDoc; // ** Printer.Canvas.StretchDraw(DestRect, Image1.Picture.Graphic); // ** finally Printer.EndDoc; end;//*************************************************************end;分数吗,这么多天只有WWWWA(aaaa) 大侠一人关注,我也崇拜两星级高手,送个人情吧,老兄以后多帮忙呀。 修改文件名 SQL语句 我想知道一下delphi流行前沿的东西!? socket问题,请进里面 我需要DELPHI6的注册吗,能给我吗,我急用 如何实现SQL查询过程与进度条关联 怪怪!!!DELPHI 7的报表组件到哪去了???? 在keydown里面怎么判断shift的值? 请问“公文系统”流程是个什么样子的呢? 如何打包DAO? 按钮的问题 单件的超级实现方法
主要代码来源于大富翁上以前的贴子,图片文件格式为wmf(图元文件)
自己加的:
Image1.Picture.Graphic.Height:=Hei;
Image1.Picture.Graphic.Width:=Wid;
这两句十分重要。
限于兄弟们分享如下:
procedure TFpms_make_table.SpeedButton4Click(Sender: TObject);
var
Ratio,Ratio1,Ratio2:Double;
wid,hei,X,Y:integer;
DestRect: TRect;
begin
if Image1.Picture=NIL then exit;
//*************************************************************
//按照纸张大小伸缩打印************** Add by cjf 2003-6-23
if not PageSetupDialog1.Execute then exit;
Ratio1 := Printer.PageWidth / Image1.Width; //Ratio1: Double
Ratio2 := Printer.PageHeight / Image1.Height; //Ratio2: Double
if Ratio1 < Ratio2 then Ratio := Ratio1 //Ratio: Double
else Ratio := Ratio2;
Wid := Round(Ratio * Image1.Width); //Wid: Integer
Hei := Round(Ratio * Image1.Height); //Hei: Integer
X := (Printer.PageWidth - Wid) shr 1; //X: Integer
Y := (Printer.PageHeight - Hei) shr 1; //Y: Integer
DestRect := Rect(X, Y, X + Wid, Y + Hei); //DestRect: TRect
Image1.Picture.Graphic.Height:=Hei;
Image1.Picture.Graphic.Width:=Wid;
try
Printer.BeginDoc; // **
Printer.Canvas.StretchDraw(DestRect, Image1.Picture.Graphic); // **
finally
Printer.EndDoc;
end;
//*************************************************************
end;
分数吗,这么多天只有WWWWA(aaaa) 大侠一人关注,我也崇拜两星级高手,送个人情吧,老兄以后多帮忙呀。