“Picturebox为什么不能打印里面的内容”的回答者请来拿分!

kmzs 2005-03-14 08:57:57
http://community.csdn.net/Expert/topic/3543/3543456.xml?temp=.4688379帖子一直没人结,但我想试试看将该问题送交FAQ,因此请主要回答者重新叙述你们的答案并给你们分数,谢谢!
...全文
71 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
kmzs 2005-03-15
  • 打赏
  • 举报
回复
Private Sub Command1_Click()
Picture1.Width = Me.Width
Picture1.Height = Me.Height
BitBlt Picture1.hDC, 0, 0, Picture1.Width, Picture1.Height, Me.hDC, 0, 0, vbSrcCopy
End Sub

就可打印了,不需要保存也可以。
maskdata 2005-03-15
  • 打赏
  • 举报
回复
给你一个方法(可能比较笨)
先把PICTURE保存成图片文件再打印图片,然后删除图片文件

Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long


Private Sub Command1_Click()
Picture1.Width = Me.Width
Picture1.Height = Me.Height
BitBlt Picture1.hDC, 0, 0, Picture1.Width, Picture1.Height, Me.hDC, 0, 0, vbSrcCopy
SavePicture Picture1.Image, "c:\acd.bmp" '保存到C盘
End Sub

Private Sub Form_Load()
Picture1.AutoRedraw = True
Picture1.Visible = False
'Picture1运行时不可见,用来保存窗体界面
End Sub


以上是把窗体保存成图片的代码
如果你要保存别的东西,就把
Picture1.Width = Me.Width
Picture1.Height = Me.Height
这两句的坐标改一下,改成你要的,然后改一下取点的坐标
laviewpbt 2005-03-14
  • 打赏
  • 举报
回复
其实这个问题已经讨论了好多次!

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧