首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

哪位大哥给小弟我一个VB.NET打印的例子啊

2012-03-09 
哪位大哥给我一个VB.NET打印的例子啊?哪位大哥给我一个VB.NET打印的例子啊?[解决办法] 查询打印Private Su

哪位大哥给我一个VB.NET打印的例子啊?
哪位大哥给我一个VB.NET打印的例子啊?

[解决办法]
'查询 打印
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.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 FontBt1 As New Font( "黑体 ", 10)
Dim LB As String = "日期 用 户 名 称 发票号码 金 额 备 注 "
e.Graphics.DrawString( " " & LB & " ", FontBt1, Brushes.Black, 50, Hjq)

[解决办法]
Private Sub Printer_PrintPage(ByVal sender As Object, ByVal ev As System.Drawing.Printing.PrintPageEventArgs)
Dim I As Integer = 0
Dim PropertyText As PubClass.Define.PropertyStru_Text
Dim strValue As String


For I = 0 To PrintString.Length - 1
GetValue(PropertyText, strValue, PrintString(I), "Prt ")
Select Case PropertyText.PrtType
Case Define.PrintTypeEnum.Text
Dim _Style As New FontStyle
_Style = FontStyle.Regular
If PropertyText.Bold Then _Style = FontStyle.Bold
If PropertyText.UnderLine Then _Style = _Style Or FontStyle.Underline
Dim f As New Font(PropertyText.Font, PropertyText.FontSize, _Style)
ev.Graphics.DrawString(strValue, f, Brushes.Black, PropertyText.X, PropertyText.Y)
f.Dispose()
f = Nothing
_Style = Nothing
Case Define.PrintTypeEnum.Line
Dim linePen As New System.Drawing.Pen(System.Drawing.Color.Black)
ev.Graphics.DrawLine(linePen, PropertyText.X, PropertyText.Y, PropertyText.ToX, PropertyText.ToY)
linePen.Dispose()
linePen = Nothing
End Select
Next

I = Nothing
PropertyText = Nothing
strValue = Nothing
End Sub


画图片用DrawImage

热点排行