利用 printdocument控件
讓客戶滿意是我們工作的目標,不斷超越客戶的期望值來自于我們對這個行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價值的長期合作伙伴,公司提供的服務(wù)項目有:主機域名、虛擬主機、營銷軟件、網(wǎng)站建設(shè)、寧陜網(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" '打印的內(nèi)容
e.Graphics.DrawString(s, stringFont, Brushes.AliceBlue, rectDraw, strFormat)
End Sub
先拖過來控件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
調(diào)用下面語句可直接用默認打印機打印出來:
PrintDocument1.Print()
txt文件:
procedure TForm1.Button1Click(Sender: TObject);
var
MyFile: TextFile;
SourceFile:TextFile;
Tmp:String;
begin
AssignPrn(MyFile);
AssignFile(SourceFile,'FilePath');
Reset(SourceFile);
Rewrite(MyFile);
Readln(SourceFile,Tmp);
While Not EOF(SourceFile) do
Begin
Writeln(MyFile, Tmp);
Readln(SourceFile,Tmp);
System.CloseFile(MyFile);
end;
圖形文件需要TPrinter.canvas來打印了,
網(wǎng)頁名稱:vb.net控件打印,vbs 打印
文章URL:http://vcdvsql.cn/article34/dsigepe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導航、企業(yè)網(wǎng)站制作、移動網(wǎng)站建設(shè)、網(wǎng)站改版、網(wǎng)站設(shè)計公司、關(guān)鍵詞優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)