请各位大侠帮忙!谢谢
解决方案 »
- Delphi 7调用C++编写的dll 出现"nvalid pointer operation"错误
- 如何取*.ico文件中,其它大小的图标
- 程序单步执行没问题,点f9却会死掉,程序只有两句代码,没有循环。望见教!
- 动态阀值法的问题!!
- 怎样判断edit中的text是数字还是字符串?
- 表1如何循环插入表2?
- 我在公司做了个程序,我把原程序带回家再编译,提示说不能建立输出一个.DCU文件,这个.DCU文件是控件产生的。请问各位什么原因?
- 数据恢复
- 关于stringgrid的问题
- idudpclient同时又加上idtcpserver这算客户还是服务端?
- 请教知道Winexec()函数的高手。。。
- 象QQ的公告栏
procedure TMainFm.PrintClick(Sender: TObject);
var
bmp :TBitmap;
ScaleX,ScaleY :Integer;
R :TRect;
begin
bmp :=TBitmap.Create;
bmp.PixelFormat:=pf4bit;
bmp.Width :=PaintBox.Width;
bmp.Height :=PaintBox.Height;
BitBlt(bmp.Canvas.Handle,0,0,bmp.Width,bmp.Height,PaintBox.Canvas.Handle,0,0,SRCCOPY);
Image.AutoSize :=True;
Image.Picture.Bitmap.Assign(bmp);
Image.Picture.SaveToFile('c:\a.bmp');
bmp.Free; if Printer.Printers.Count=0 then
begin
ShowMessage('请首先安装打印机');
Exit;
end;
if not PrintDialog.Execute then Exit
else
begin
with Printer do
begin
BeginDoc;
ScaleX :=GetDeviceCaps(Handle,LogPixelsX) div PixelsPerInch;
ScaleY :=GetDeviceCaps(Handle,LogPixelsY) div PixelsPerInch;
R :=Rect(0,0,Image.Width*ScaleX,Image.Height*ScaleY);
Canvas.StretchDraw(R,Image.Picture.Graphic);
EndDoc;
end;
end;
end;