这个,,这个,,呵呵。
// 未处理 Doc 缩放,未处理非半透明
procedure PrinterPNGFile(const PngFile,BmpFile: string;Printer:TPrinter);
var
PNG: TPNGObject;
BMP: TBitmap;
begin
BMP := TBitmap.Create;
try
BMP.LoadFromFile(BmpFile);
if FileExists(PngFile) then
begin
PNG := TPNGObject.Create;
PNG.LoadFromFile(PngFile);
if Assigned(Printer) then
try
Printer.BeginDoc;
SetStretchBltMode(Printer.Canvas.Handle,COLORONCOLOR);
Printer.Canvas.StretchDraw(Printer.Canvas.ClipRect,BMP);
if PNG.TransparencyMode <> ptmPartial then
MessageBox(0,'png not Transparency, Bitmap be overlay','warning',0);
PNG.Draw(Printer.Canvas,Printer.Canvas.ClipRect);
finally
Printer.EndDoc;
PNG.Free;
end;
end;
finally
BMP.Free;
end
end;