0
我遇到了我當前項目的另一個問題。我有一張需要打印的表格。在網上做一些搜索,我找到了一些例子,並將其實現到我的代碼中。它打印,但打印所有我的文本框和標籤堆疊在一起。我怎樣才能得到這個打印我的文本框和標籤格式,因爲我有他們的形式?VB 2010 PrintDocument堆棧打印的文本
這裏是我的代碼:
Private Sub PrintToolStripMenuItem1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem1.Click
PrintDocument1.PrinterSettings.Copies = 2
PrintDocument1.Print()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
e.Graphics.DrawString(TextBox1.Text, TextBox1.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(Label1.Text, Label1.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(Label2.Text, Label2.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(datebox.Text, datebox.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(Label3.Text, Label3.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(locationbox.Text, locationbox.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(Label4.Text, Label4.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(groupbox.Text, groupbox.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(Label5.Text, Label5.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(passbox.Text, passbox.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(Label7.Text, Label7.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(TextBox6.Text, TextBox6.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(apbox.Text, apbox.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(Label8.Text, Label8.Font, Brushes.Blue, 100, 100)
e.Graphics.DrawString(TextBox7.Text, TextBox7.Font, Brushes.Blue, 100, 100)
End Sub
我還在新到VB 2010所以任何幫助表示讚賞,謝謝!