关于Graphics 打印的问题

[复制链接]
查看11 | 回复2 | 2021-1-27 05:11:19 | 显示全部楼层 |阅读模式
我现在有这样一段代码

DimMyPicGraphicsAsGraphics=PictureBox1.CreateGraphics
DimPinkBrushAsNewSolidBrush(Color.Pink)
DimBlackPenAsNewPen(Brushes.Black)'采用默认的画笔宽度值为1
'在窗体上填充一个实心的椭圆
MyPicGraphics.FillEllipse(PinkBrush,NewRectangle(2,2,80,50))
'在窗体上绘制一个空心的椭圆
MyPicGraphics.DrawEllipse(BlackPen,NewRectangle(2,2,80,50))
MyPicGraphics.DrawString("测试文字",NewFont("宋体",20),NewSolidBrush(Color.Blue),50,10)

这个Graphics绘制好了,但我现在想打印这个Graphics内容
我直接用:PrintDocument1.Print()打出来是空白的,应该怎么使用?

分 -->
回复

使用道具 举报

千问 | 2021-1-27 05:11:19 | 显示全部楼层
要在printDouument1的graphics中再画一遍
PrivateSubPrintDocument1_PrintPage(senderAsObject,eAsPrinting.PrintPageEventArgs)HandlesPrintDocument1.PrintPage
e.Graphics.FillEllipse(........)
EndSub
回复

使用道具 举报

千问 | 2021-1-27 05:11:19 | 显示全部楼层
'得到持久图像
dimbmpasnewbitmap(w,h)
DimMyPicGraphicsAsGraphics=graphics.fromimage(bmp)
‘显示
PictureBox1.backimage=bmp
'在printdoc中绘制bmp
e.graphics.drawimage(bmp........)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行