我正在使用公共对话框控件来打印picturebox的内容。下面是我的代码:
Private Sub mnuFilePrint_Click()
StopPrinting = False
' Set CancelError is True
On Error GoTo errhandler
cmndlg.PrinterDefault = True
' Set flags
cmndlg.Flags = cdlPDReturnDC + cdlPDNoPageNums
cmndlg.ShowPrinter
pigraph.Picture = picGraph.Image
Printer.Print picGraph.Picture
Printer.EndDoc
Exit Sub
errhandler:
Select Case Err
Case 32755 ' Dialog Cancelled
MsgBox "you cancelled the dialog box"
Case Else
MsgBox "Unexpected error. Err " & Err & " : " & Error
End Select
End Sub
一旦单击print按钮,就会打开print对话框,然后我单击print。但我收到的纸张是空白的,除了页面顶部的一个随机数字字符串(每次打印时都会发生变化)。
有人知道为什么会出现这个问题吗?我不应该得到一张白纸。谢谢。
发布于 2021-11-17 00:37:56
更具体地说,pic.picture只包含您加载的图片,但不包含线或圆等图形元素。设置picture=图像提供图形元素。奇怪的是,没有任何文档告诉你这一点。
https://stackoverflow.com/questions/38434305
复制相似问题