我制作了一个生成QRcode的代码。 而现在我正试图用热敏纸打印它。但是我怎样才能打印出特定尺寸的纸张?谢谢
Private Sub GraphicPrint(ByVal sender As Object, ByVal e As PrintPageEventArgs)
Dim x As Integer = 60
Dim y As Integer = 60
Dim width As Integer = 100
Dim height As Integer = 50
' e.Graphics.DrawImage(Image.FromFile(GraphicLocation.Text), x, y, width, height, e.Graphics.VisibleClipBounds)
e.Graphics.DrawImage(Image.FromFile(GraphicLocation.Text), x, y, width, height)
e.HasMorePages = False
End Sub
Private Sub BeginGraphicPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BeginGraphicPrint.Click
Try
AddHandler PrintGraphicControl.PrintPage, AddressOf Me.GraphicPrint
PrintGraphicControl.Print()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
答案 0 :(得分:1)
尝试这样的事情
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim g As Graphics = e.Graphics
' Draw image to screen.
g.DrawImage(Piccode.Image, 0, 0, 100, 100)
End Sub