0
打印副本號碼例如,我有一個標籤要打印,如下面的示例,現在如果我想打印3份副本,如何打印副本號碼在我打印的標籤中的某處?如何使用system.drawing.printing.printdocument vb.net
示例代碼:
Private Sub btnPrintProcLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintProcLabel.Click
If ValidateData() Then
AddHandler PrintDocument1.PrintPage, AddressOf PrintProcLabel
Try
PrintDocument1.PrinterSettings.PrinterName = SinglePrinter.PrinterSettings.PrinterName
PrintDocument1.PrinterSettings.Copies = CInt(txtCopies.Text)
PrintDocument1.Print()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
Public Sub PrintProcLabel(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
Dim g As Graphics = e.Graphics
Dim br As Brush = New SolidBrush(Color.Black)
Dim pn As Pen = New Pen(br)
g.DrawString(Today.Month & "/" & Today.Day & "/" & Today.Year, Arial, br, 250, 3)
End Sub
是的,我想迭代的次數與'txtCopies.Text'中指定的次數一樣多,所以我可以每次都有特定的拷貝數。我認爲沒有其他辦法可以做到這一點。 – Somebody