rt
解决方案 »
- 请大虾们用listview+adoquery编一个简单的数据查询
- delphi 的 printer 如何打印 发票的连续纸
- 关于调用dll文件的问题
- 如何屏蔽TwebBrowser中页面弹出的对话框?
- 关于sql语句的查询,100分
- 用ado连接Excel文件,一个列应是string,可连接后adotable的字段却是float,怎幺办啊?急得很
- 怒放,来接分吧
- 在用DBGrid怎么取他某个字段的值啊
- 请教:使用Delphi下载DB2数据库中的BLOb字段内容
- 用自己写的函数调用dll,总是编译不通过,如何解决(再调用自己函数时)
- 关于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是什么?