
正文
vb.net标签打印 vb打印代码怎么写
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
VB.NET 打印问题。
先拖过来控件PrintDocument1,然后双击PrintDocument1,在它的PrintPage事件中加入代码如下:
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
dim a as String
a="abcd"
Dim mypen As Pen = New Pen(Color.Blue, 2)
e.Graphics.DrawString(a, New Font("宋体", 20), New Pen(Color.Black, 1).Brush, 30, 30)
End Sub
调用下面语句可直接用默认打印机打印出来:
PrintDocument1.Print()
相关问答
Q1: vb.net 传参调用BarTender模板实现动态打印
你用的版本太高了吧。 我用的7.75 你参考一下 先要打开bartend.exe Shell ("D:\Program Files\Seagull\BarTender\7.75\bartend.exe /af=E:\abc\abc.btw /p /x /?qdh=""" randqdh """") dll应该是不用调用的,调用dll需要用正版
Q2: VB.NET怎么实现打印功能啊 呜呜(
利用 printdocument控件
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
PrintDocument1.Print()
End Sub
Private Sub PrintDocument1_PrintPage(sender As System.Object, e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim stringFont As New Font("Arial", 16)
Dim rectDraw As New RectangleF(e.MarginBounds.Left, e.MarginBounds.Top, e.MarginBounds.Width, e.MarginBounds.Height)
Dim strFormat As New StringFormat
Dim s As String
s = "print word" '打印的内容
e.Graphics.DrawString(s, stringFont, Brushes.AliceBlue, rectDraw, strFormat)
End Sub
Q3: vb.net Document_PrintPag 打印
我帮你把最后一部分的语句顺序调换一下。你试一试
sub button1_click() '---执行打印
Dim pd As PrintDocument = New PrintDocument
pd.PrinterSettings = PrintDialog1.PrinterSettings
If _PrintDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
for i=0 to 1 '这样可以两次截图
CaptureScreen() '--执行前面自定义函数截图
AddHandler pd.PrintPage, AddressOf Document_PrintPage
pd.Print()
Threading.Thread.sleep(100) ‘ 再加上一个间隔
next
end sub
vb.net标签打印的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb打印代码怎么写、vb.net标签打印的信息别忘了在本站进行查找喔。







