怎样将Panel上显示的内容打印出来 rt 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure PrintPanel(Panel: TPanel; SLeft, STop, SWidth, SHeight, Left, Top: LongInt; HScale, ZScale: Real);var WJDC: HDC; WJBitMap: TBitMap; Info: PBitMapInfo; InfoSize, ImageSize: DWORD; Image: Pointer;begin Printer.BeginDoc; WJBitMap := TBitMap.Create; WJBitMap.Width := SWidth; WJBitMap.Height := SHeight; WJDC := GetDC(Panel.Handle); BitBlt(WJBitMap.Canvas.Handle, 0, 0, SWidth, SHeight, WJDC, SLeft, STop, SRCCOPY); ReleaseDC(Panel.Handle, WJDC); GetDIBSizes(WJBitMap.Handle, InfoSize, ImageSize); GetMem(Info, InfoSize); GetMem(Image, ImageSize); GetDIB(WJBitMap.Handle, 0, Info^, Image^); StretchDIBits(Printer.Canvas.Handle, Left, Top, Round((Panel.Width - 2) * HScale), Round((Panel.Height - 2) * ZScale), 0, 0, Info^.bmiHeader.biWidth, Info^.bmiHeader.biHeight, Image, Info^, DIB_RGB_COLORS, SRCCOPY); FreeMem(Image, ImageSize); FreeMem(Info, InfoSize); WJBitMap.Free; Printer.EndDoc;end; uses printers;procedure TForm1.Button1Click(Sender: TObject);var Bitmap: TBitmap;begin Bitmap := TBitmap.Create; Bitmap.Width := Panel1.Width; Bitmap.Height := Panel1.Height; try Panel1.PaintTo(Bitmap.Canvas,0,0); Bitmap.SaveToFile('g:\jjj.bmp'); //Use Bitmap Do SomeThing.. finally Bitmap.Free; end;///////////打印image//////Image1.Picture.LoadFromFile('f:\jjj.bmp'); with Image1.Picture.Bitmap do begin Printer.BeginDoc; Printer.Canvas.StretchDraw(Canvas.ClipRect,Image1.Picture.Bitmap); Printer.EndDoc; end; end; 这样 效果不错 uses printers;Printer.BeginDoc; panel1.PaintTo(Printer.Canvas,1,1); Printer.EndDoc;这样也可以 uses printers;Printer.BeginDoc;panel1.PaintTo(Printer.Canvas,1,1);Printer.EndDoc;__________________________________________________用上面的方法打印出来的东西怎么变得很小(长宽只有1厘米)? procedure PrintPanel(Panel: TPanel; SLeft, STop, SWidth, SHeight, Left, Top: LongInt; HScale, ZScale: Real);________________________________________________________________HScale, ZScale是什么? 最简便的方法可以用rm报表控件包的RMReport,然后一句代码就可以了 请问Inno Setup完成安装时的文字在哪里设置? 什么是通用数据库查询系统?它有什么功能? 截取中文字符串 TServerSocket 该控件到哪里去找? 请问,如果把一个文本文件转化为二进制文件,是否能减小文本文件的大小 再线等待。。请问在DELPHI 中如何调用shellexecute命令 散分啊,120分啊,我 几个问题 都没有回答啊, 用Rave5.1.1打印出现乱码(在线等待!) delphi,TMemoryStream如何从剪切板中得到数据 delphi 打开源码一个控件便消失了,咋回事? 关于BPL 的调用路径设置问题,望高人指点,急 打印机的页面格式设置问题,请高手指点
HScale, ZScale: Real);
var
WJDC: HDC;
WJBitMap: TBitMap;
Info: PBitMapInfo;
InfoSize, ImageSize: DWORD;
Image: Pointer;
begin
Printer.BeginDoc; WJBitMap := TBitMap.Create;
WJBitMap.Width := SWidth;
WJBitMap.Height := SHeight; WJDC := GetDC(Panel.Handle);
BitBlt(WJBitMap.Canvas.Handle, 0, 0, SWidth, SHeight, WJDC, SLeft, STop, SRCCOPY);
ReleaseDC(Panel.Handle, WJDC); GetDIBSizes(WJBitMap.Handle, InfoSize, ImageSize);
GetMem(Info, InfoSize);
GetMem(Image, ImageSize);
GetDIB(WJBitMap.Handle, 0, Info^, Image^); StretchDIBits(Printer.Canvas.Handle, Left, Top, Round((Panel.Width - 2) * HScale),
Round((Panel.Height - 2) * ZScale), 0, 0, Info^.bmiHeader.biWidth,
Info^.bmiHeader.biHeight, Image, Info^, DIB_RGB_COLORS, SRCCOPY);
FreeMem(Image, ImageSize);
FreeMem(Info, InfoSize);
WJBitMap.Free;
Printer.EndDoc;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Bitmap: TBitmap;
begin
Bitmap := TBitmap.Create;
Bitmap.Width := Panel1.Width;
Bitmap.Height := Panel1.Height;
try
Panel1.PaintTo(Bitmap.Canvas,0,0);
Bitmap.SaveToFile('g:\jjj.bmp');
//Use Bitmap Do SomeThing..
finally
Bitmap.Free;
end;
////
///////打印image
//////
Image1.Picture.LoadFromFile('f:\jjj.bmp');
with Image1.Picture.Bitmap do
begin
Printer.BeginDoc;
Printer.Canvas.StretchDraw(Canvas.ClipRect,Image1.Picture.Bitmap);
Printer.EndDoc;
end;
end;
这样 效果不错
panel1.PaintTo(Printer.Canvas,1,1);
Printer.EndDoc;这样也可以
panel1.PaintTo(Printer.Canvas,1,1);
Printer.EndDoc;__________________________________________________用上面的方法打印出来的东西怎么变得很小(长宽只有1厘米)?
HScale, ZScale: Real);________________________________________________________________HScale, ZScale是什么?