真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net打印文字 vb怎樣在文本框上打印文字

VB.NET怎么實(shí)現(xiàn)打印功能啊 嗚嗚(

利用 printdocument控件

讓客戶(hù)滿(mǎn)意是我們工作的目標(biāo),不斷超越客戶(hù)的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶(hù),將通過(guò)不懈努力成為客戶(hù)在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:申請(qǐng)域名、雅安服務(wù)器托管、營(yíng)銷(xiāo)軟件、網(wǎng)站建設(shè)、宜賓網(wǎng)站維護(hù)、網(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" '打印的內(nèi)容

e.Graphics.DrawString(s, stringFont, Brushes.AliceBlue, rectDraw, strFormat)

End Sub

怎樣用熱敏打印機(jī)把vb.net窗體內(nèi)文本框內(nèi)容打印出來(lái)

用PrintForm控件,在Visual Basic PowerPacks項(xiàng)目列表中vb2008 SP1以后版本就有了,下面是代碼

Imports System.Drawing.Printing

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'先設(shè)置打印頁(yè)面的頁(yè)邊距

With Me.PrintForm1

Dim myMargins As New Margins '頁(yè)邊距設(shè)置信息是存放在這個(gè)Margins類(lèi)型的對(duì)象中的

With myMargins '分別設(shè)置上下左右邊距,

.Left = 12

.Right = 12

.Top = 12

.Bottom = 12

End With

.PrinterSettings.DefaultPageSettings.Margins = myMargins '把myMargins對(duì)象賦給PrintForm1的設(shè)置屬性

End With

Me.Button1.Visible = False '這個(gè)是在打印的時(shí)候隱藏打印按鈕

Me.PrintForm1.Form = Me '設(shè)置要打印的窗體

Me.PrintForm1.Print() '調(diào)用打印窗體方法

Me.Button1.Visible = True '再把隱藏的打印按鈕顯示出來(lái)

End Sub

VB.NET如何能將文本框中的內(nèi)容原樣打印

Imports?System.Drawing.Printing

Public?Class?Form1

Private?Sub?Button1_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click

Try

Dim?PDoc?As?New?PrintDocument

AddHandler?PDoc.PrintPage,?AddressOf?Me.PText

PDoc.Print()

Catch?ex?As?Exception

MessageBox.Show("error",?ex.ToString)

End?Try

End?Sub

Private?Sub?PText(ByVal?sender?As?Object,?ByVal?e?As?PrintPageEventArgs)

e.Graphics.DrawString(TextBox1.Text,?New?Font("Arial",?11,?FontStyle.Regular),?Brushes.Black,?120,?120)

e.HasMorePages?=?False

End?Sub

End?Class


分享文章:vb.net打印文字 vb怎樣在文本框上打印文字
標(biāo)題網(wǎng)址:http://weahome.cn/article/hejjoi.html

其他資訊

在線咨詢(xún)

微信咨詢(xún)

電話咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部