vb.net直接打印 vb打印功能

VB.NET如何能将文本框中的内容原样打印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如何实现打印DataGridView1里的内容,求源码使用 PrintDocument 控件的 Print() 方法可以打印指定对象中的内容,参考代码如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PrintDocument1.Print()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim bm As New Bitmap(Me.DataGridView1.Width, Me.DataGridView1.Height)
DataGridView1.DrawToBitmap(bm, New Rectangle(0, 0, Me.DataGridView1.Width, Me.DataGridView1.Height))
e.Graphics.DrawImage(bm, 0, 0)
End Sub
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()
vb.net 打印功能可以把数据导出到EXCEL,然后使用EXCEL进一步处理后使用 。
也可以做成vb报表(VB自带有) 。
先设置报表格式,打印时向报表传递数据就可以了 。
vb.net如何实现打印整个panel的内容(打印机打?。?/h2>使用jquery.print插件
我用得jQuery.print, version 1.3.2 。
页面上调用代码如下:PrintArea就是你panel的ID....
script src="/images/defaultpic.gif"/script
script
function printarea() {
$("#PrintArea").print({
globalStyles: true,
mediaPrint: false,
stylesheet: null,
noPrintSelector: ".no-print",
iframe: true,
append: null,
prepend: null,
manuallyCopyFormValues: true,
deferred: $.Deferred()
});
}
/script
a class="btn btn-success" onclick="printarea()"打印/a
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"'打印vb.net直接打印的内容
e.Graphics.DrawString(s, stringFont, Brushes.AliceBlue, rectDraw, strFormat)
End Sub
【vb.net直接打印 vb打印功能】vb.net直接打印的介绍就聊到这里吧,感谢你花时间阅读本站内容 , 更多关于vb打印功能、vb.net直接打印的信息别忘了在本站进行查找喔 。

    推荐阅读