注册 登录
编程论坛 VB.NET论坛

vb.net控制直接打印程序

ziyouyu 发布于 2008-03-12 13:55, 2718 次点击
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As Printing.PrintPageEventArgs)
        'Dim leftMargin As Single = ev.MarginBounds.Left
        Dim line1 As String = Trim(TextBox6.Text).Substring(0, 14)
        Dim line2 As String = TextBox6.Text.ToString.Substring(14, 5)
        ev.Graphics.DrawString(TextBox1.Text, printFont, Brushes.Black, xPos, yPos + 25, New StringFormat())
        ev.Graphics.DrawString(TextBox2.Text + TextBox8.Text, printFont, Brushes.Black, xPos, yPos + 65, New StringFormat())
        ev.Graphics.DrawString(TextBox3.Text + TextBox7.Text, printFont, Brushes.Black, xPos, yPos + 110, New StringFormat())
        ev.Graphics.DrawString(TextBox4.Text, printFont, Brushes.Black, xPos, yPos + 155, New StringFormat())
        ev.Graphics.DrawString(TextBox5.Text, printFont, Brushes.Black, xPos, yPos + 200, New StringFormat())
        ev.Graphics.DrawString(line1, printFont, Brushes.Black, xPos + 50, yPos + 240, New StringFormat())
        ev.Graphics.DrawString(line2, printFont, Brushes.Black, xPos - 70, yPos + 270, New StringFormat())
        ' Indicate that this is the last page to print.
        ev.HasMorePages = False
    End Sub
3 回复
#2
babyboy992008-03-14 09:31
可不可以解释一下句子的意思,我是新手,有些看不明白!谢谢!
#3
2008-07-19 20:44
恩,还看不懂 呀,楼主再辛苦点给个解释好吗?
#4
tntzwc2008-07-21 17:24
这种打印方法就像画图一样。
把你想打印的东西,用graphics画出来就可以了。
1