问题: 重金求解:怎样把paintbox中绘制的图形保存到image或canvas或bmp,然后打印出来! ( 积分: 300 )
分类: 图形图象
来自: ydiandian, 时间: 2001-11-07 19:39:00, ID: 714271
我在paintbox中利用他的canvas属性来绘制需要的图形,然后要将绘制
好的图形打印出来,怎样才能将需要的部分打印出来呢?
急!谢谢
来自: ydiandian, 时间: 2001-11-07 19:43:00, ID: 714281
原来是 copy,
具体怎么用呢?
来自: BornKilled, 时间: 2001-11-07 19:44:00, ID: 714283
如果要打印的效果好的话,还是直接在printer 的canvas上画比较合适
你为什么不同时画两份?
来自: 卷起千堆雪tyn, 时间: 2001-11-07 19:46:00, ID: 714286
你首先将PaintBox绘制的图形这样处理 :
var
bmp :TBitmap;
begin
bmp :=TBitmap.Create;
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);
bmp.Free;
end;
打印:
var
ScaleX,ScaleY :Integer;
R :TRect;
begin
if Printer.Printers.Count=0 then
begin
ShowMessage('请首先安装打印机');
Exit; //跳出N11Click
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;
来自: ydiandian, 时间: 2001-11-07 19:55:00, ID: 714293
卷起千堆雪tyn:马上看看行否?
BornKilled:下次试一下你的方法!
先谢了
来自: ydiandian, 时间: 2001-11-07 20:15:00, ID: 714339
图形打印出来了,但背景色不是白色.
打印出来的东西,背景色怎么设置为白色呢?
来自: ydiandian, 时间: 2001-11-07 20:36:00, ID: 714408
对了,还有,怎样将图形放大打印出来呢?
来自: ydiandian, 时间: 2001-11-08 13:25:00, ID: 715876
BornKilled:直接在printer 的canvas上画比较合适,但是怎么画呢?
画完的图形怎么打印出来呢?
来自: 卷起千堆雪tyn, 时间: 2001-11-08 13:32:00, ID: 715899
你打印出来的背景色是什么?
R :=Rect(0,0,Image.Width*ScaleX,Image.Height*ScaleY);
这是按照原图大小打印 , 你如果想放大打印, 可以改变这两个值:
Image.Width*ScaleX和Image.Height*ScaleY,比如都乘以某个系数,可以分别是不同的系数.
来自: ydiandian, 时间: 2001-12-10 20:00:00, ID: 777882
谢谢
来自: ydiandian, 时间: 2001-12-11 9:32:00, ID: 778764
xie xie
来自: ydiandian, 时间: 2001-12-11 9:38:00, ID: 778795
谢谢
得分大富翁: BornKilled-80,卷起千堆雪tyn-220,