利用 printdocument控件
創(chuàng)新互聯(lián)堅持“要么做到,要么別承諾”的工作理念,服務領域包括:成都網(wǎng)站設計、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務,滿足客戶于互聯(lián)網(wǎng)時代的秀洲網(wǎng)站設計、移動媒體設計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡建設合作伙伴!
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
有個PrintDocument控件,可以實現(xiàn)打印。。。
MSDN原話:
使用 PrintDocument 組件
涉及 PrintDocument 組件的兩種主要情況是:
簡單的打印作業(yè),如打印單個文本文件。在這種情況下,應將 PrintDocument 組件添加到 Windows 窗體,然后在 PrintPage 事件處理程序中添加打印文件的編程邏輯。 該編程邏輯應以使用 Print 方法打印文檔結束。
此方法向打印機發(fā)送一個 Graphics 對象,該對象包含在 PrintPageEventArgs 類的 Graphics 屬性中。
有關如何使用 PrintDocument 組件打印文本文檔的示例,請參見
如何:打印 Windows 窗體中的多頁文本文件。
更為復雜的打印作業(yè),如想要重新使用已編寫的打印邏輯的情況。
在這種情況下,應從 PrintDocument 組件派生一個新組件,并重寫
(請參見 Visual Basic 的 重寫或 C# 的 重寫) PrintPage 事件。
將 PrintDocument 組件添加到窗體后,它出現(xiàn)在 Windows 窗體設計器底部的欄中
PrintDocument1.Print()
使用PrintDocument進行打印“Brush, 50, 80”50左邊距離,80上面距離
Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim mypen As Pen = New Pen(Color.Blue, 2)
e.Graphics.DrawString("取號單", New Font("Microsoft Sans Serif", 18, FontStyle.Bold), New Pen(Color.Black, 1).Brush, 30, 30)
e.Graphics.DrawString("XXXXXX", New Font("Microsoft Sans Serif", 24, FontStyle.Regular), New Pen(Color.Black, 1).Brush, 50, 80)
e.Graphics.DrawString("您的號碼是:", New Font("Microsoft Sans Serif", 16, FontStyle.Regular), New Pen(Color.Black, 1).Brush, 30, 135)
e.Graphics.DrawString("打印時間:" Now(), New Font("Microsoft Sans Serif", 10, FontStyle.Regular), New Pen(Color.Black, 1).Brush, 80, 330)
End Sub
你用的版本太高了吧。 我用的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需要用正版
網(wǎng)頁名稱:vb.net標簽打印 vb窗口打印
本文地址:http://chinadenli.net/article14/dogcode.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站維護、全網(wǎng)營銷推廣、Google、域名注冊、定制開發(fā)、網(wǎng)站建設
聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)