程序代码:
Private Sub printgraphictongzhidan(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
Dim dfk As New Pen(Color.Black, 2)
Dim newpen As New Pen(Color.Black)
ev.Graphics.DrawString("阿 图 什 市 建 设 局 建 设 工 程 申 请 表", New Font("宋体", 18, FontStyle.Bold), Brushes.Black, 177, 99)
ev.Graphics.DrawRectangle(dfk, 60, 140, 710, 958)
Dim x1 As Integer
Dim y1 As Integer
Dim x2 As Integer
Dim y2 As Integer
x1 = 60
y1 = 180
x2 = 770
y2 = 180
ev.Graphics.DrawLine(newpen, 60, 180, 770, 180)
y1 = y1 + 40
y2 = y2 + 40
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
y1 = y1 + 40
y2 = y2 + 40
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
y1 = y1 + 40
y2 = y2 + 40
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
y1 = y1 + 239
y2 = y2 + 239
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
y1 = y1 + 239
y2 = y2 + 239
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
y1 = y1 + 240
y2 = y2 + 240
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
y1 = y1 + 80
y2 = y2 + 80
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
ev.Graphics.DrawLine(newpen, 136, 140, 136, 300)
ev.Graphics.DrawLine(newpen, 465, 140, 465, 300)
ev.Graphics.DrawLine(newpen, 541, 140, 541, 300)
ev.Graphics.DrawString("建设单位", printfont1, Brushes.Black, 71, 151)
ev.Graphics.DrawString("建设项目", printfont1, Brushes.Black, 71, 192)
ev.Graphics.DrawString("建筑面积", printfont1, Brushes.Black, 71, 232)
ev.Graphics.DrawString("总 投 资", printfont1, Brushes.Black, 71, 271)
ev.Graphics.DrawString("市住建局(城市配套费):", printfont1, Brushes.Black, 71, 314)
ev.Graphics.DrawString("市统筹站(劳保统筹费):", printfont1, Brushes.Black, 71, 553)
ev.Graphics.DrawString("市规划局(定桩费):", printfont1, Brushes.Black, 71, 792)
ev.Graphics.DrawString("主管领导审查结果:", printfont1, Brushes.Black, 71, 1032)
ev.Graphics.DrawString(建设单位TextBox2.Text, printfont1, Brushes.Black, 140, 152)
ev.Graphics.DrawString(J新建TextBox.Text, printfont1, Brushes.Black, 140, 192)
ev.Graphics.DrawString(面积TextBox.Text & 面积标注ComboBox2.Text, printfont1, Brushes.Black, 140, 232)
ev.Graphics.DrawString(TextBox45.Text, printfont1, Brushes.Black, 140, 271)
ev.Graphics.DrawString("建设位置", printfont1, Brushes.Black, 474, 151)
ev.Graphics.DrawString("结 构", printfont1, Brushes.Black, 474, 192)
ev.Graphics.DrawString("层 数", printfont1, Brushes.Black, 474, 232)
ev.Graphics.DrawString("定 桩 费", printfont1, Brushes.Black, 474, 271)
ev.Graphics.DrawString(建设位置ComboBox1.Text, printfont1, Brushes.Black, 546, 152)
ev.Graphics.DrawString(J结构ComboBox.Text, printfont1, Brushes.Black, 546, 192)
ev.Graphics.DrawString(层数TextBox1.Text, printfont1, Brushes.Black, 546, 232)
ev.Graphics.DrawString(TextBox46.Text, printfont1, Brushes.Black, 546, 271)
x1 = Nothing
y1 = Nothing
x2 = Nothing
y2 = Nothing
ev.Graphics.Dispose()
ev.HasMorePages = False
End Sub
Private Sub printgraphicshenpi(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
Dim dfk As New Pen(Color.Black, 2)
Dim newpen As New Pen(Color.Black)
ev.Graphics.DrawString("阿图什市规划局建设项目选址意见审批表", New Font("宋体", 18, FontStyle.Bold), Brushes.Black, 177, 99)
ev.Graphics.DrawRectangle(dfk, 60, 140, 710, 958)
Dim x1 As Integer
Dim y1 As Integer
Dim x2 As Integer
Dim y2 As Integer
x1 = 60
y1 = 180
x2 = 770
y2 = 180
ev.Graphics.DrawLine(newpen, 60, 180, 770, 180)
y1 = y1 + 40
y2 = y2 + 40
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
y1 = y1 + 146
y2 = y2 + 146
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
y1 = y1 + 146
y2 = y2 + 146
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
y1 = y1 + 146
y2 = y2 + 146
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
y1 = y1 + 146
y2 = y2 + 146
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
y1 = y1 + 148
y2 = y2 + 148
ev.Graphics.DrawLine(newpen, x1, y1, x2, y2)
ev.Graphics.DrawLine(newpen, 136, 140, 136, 220)
ev.Graphics.DrawLine(newpen, 465, 140, 462, 220)
ev.Graphics.DrawLine(newpen, 541, 140, 541, 220)
ev.Graphics.DrawString("申请单位", New Font("宋体", 10, FontStyle.Bold), Brushes.Black, 70, 152)
ev.Graphics.DrawString("建设项目", New Font("宋体", 10, FontStyle.Bold), Brushes.Black, 70, 191)
ev.Graphics.DrawString("建设位置", New Font("宋体", 10, FontStyle.Bold), Brushes.Black, 476, 152)
ev.Graphics.DrawString("建筑面积", New Font("宋体", 10, FontStyle.Bold), Brushes.Black, 476, 191)
ev.Graphics.DrawString(TextBox30.Text, printfont1, Brushes.Black, 141, 152)
ev.Graphics.DrawString(TextBox49.Text, printfont1, Brushes.Black, 141, 191)
ev.Graphics.DrawString(ComboBox7.Text, printfont1, Brushes.Black, 547, 152)
ev.Graphics.DrawString(TextBox51.Text, printfont1, Brushes.Black, 547, 191)
ev.Graphics.DrawString("经办人意见:", printfont1, Brushes.Black, 66, 225)
ev.Graphics.DrawString("经办人:" & TextBox48.Text & " 日期:" & DateTimePicker5.Text, printfont1, Brushes.Black, 480, 349)
ev.Graphics.DrawString("签名: " & "日期:", printfont1, Brushes.Black, 476, 495)
ev.Graphics.DrawString("签名: " & "日期:", printfont1, Brushes.Black, 476, 641)
ev.Graphics.DrawString("签名: " & "日期:", printfont1, Brushes.Black, 476, 787)
ev.Graphics.DrawString("签名: " & "日期:", printfont1, Brushes.Black, 476, 933)
ev.Graphics.DrawString("签名: " & "日期:", printfont1, Brushes.Black, 476, 1081)
Dim numchars As Integer
Dim numlines As Integer
Dim stringfopage As String
Dim strformat As New StringFormat
Dim rectdraw As New RectangleF(70, 246, 690, 130)
Dim sizemeasure As New SizeF(690, 130 - printfont.GetHeight(ev.Graphics))
strformat.Trimming = StringTrimming.Word
ev.Graphics.MeasureString(stringtoprint, printfont, sizemeasure, strformat, numchars, numlines)
stringfopage = stringtoprint.Substring(0, numchars)
ev.Graphics.DrawString(stringfopage, printfont, Brushes.Black, rectdraw, strformat)
x1 = Nothing
y1 = Nothing
x2 = Nothing
y2 = Nothing
ev.Graphics.Dispose()
ev.HasMorePages = False
End Sub
Private Sub printgraphicxcxukezheng(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
Dim x As Integer
Dim y As Integer
x = 995
y = 110
ev.Graphics.DrawString(TextBox44.Text, New Font("宋体", 13, FontStyle.Regular), Brushes.Black, 455, 274)
ev.Graphics.DrawString(TextBox39.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
y = y + 50
ev.Graphics.DrawString(TextBox41.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
y = y + 50
ev.Graphics.DrawString(ComboBox6.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
y = y + 50
ev.Graphics.DrawString(TextBox40.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
y = y + 50
ev.Graphics.DrawString(TextBox38.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
ev.Graphics.DrawString("阿图什市规划局", New Font("宋体", 16, FontStyle.Regular), Brushes.Black, 405, 700)
ev.Graphics.DrawString(DateTimePicker4.Text, New Font("宋体", 13, FontStyle.Regular), Brushes.Black, 419, 753)
Dim numchars As Integer
Dim numlines As Integer
Dim stringfopage As String
Dim strformat As New StringFormat
Dim rectdraw As New RectangleF(820, 325, 530, 237)
Dim sizemeasure As New SizeF(543, 180 - printfont.GetHeight(ev.Graphics))
strformat.Trimming = StringTrimming.Word
ev.Graphics.MeasureString(stringtoprint, printfont, sizemeasure, strformat, numchars, numlines)
stringfopage = stringtoprint.Substring(0, numchars)
ev.Graphics.DrawString(stringfopage, printfont, Brushes.Black, rectdraw, strformat)
x = Nothing
y = Nothing
ev.Graphics.Dispose()
ev.HasMorePages = False
End Sub
Private Sub printgraphicYDxukezheng(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
Dim x As Integer
Dim y As Integer
x = 990
y = 120
ev.Graphics.DrawString(TextBox12.Text, New Font("宋体", 13, FontStyle.Regular), Brushes.Black, 450, 274)
ev.Graphics.DrawString(建设单位TextBox.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
y = y + 45
ev.Graphics.DrawString(D新划TextBox.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
y = y + 45
ev.Graphics.DrawString(D位置在TextBox.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
y = y + 45
ev.Graphics.DrawString(D该用地TextBox.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
y = y + 45
ev.Graphics.DrawString(D总面积TextBox.Text & 用地面积标注ComboBox1.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
y = y + 45
ev.Graphics.DrawString(TextBox6.Text & 建设规模标注ComboBox.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
y = y + 45
x = x - 35
ev.Graphics.DrawString("建设用地蓝线图:" & 建设用地红线图TextBox.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y)
ev.Graphics.DrawString("阿图什市规划局", New Font("宋体", 16, FontStyle.Regular), Brushes.Black, 405, 700)
ev.Graphics.DrawString(DateTimePicker1.Text, New Font("宋体", 13, FontStyle.Regular), Brushes.Black, 419, 753)
Dim numchars As Integer
Dim numlines As Integer
Dim stringfopage As String
Dim strformat As New StringFormat
Dim rectdraw As New RectangleF(820, 420, 530, 237)
Dim sizemeasure As New SizeF(543, 180 - printfont.GetHeight(ev.Graphics))
strformat.Trimming = StringTrimming.Word
ev.Graphics.MeasureString(stringtoprint, printfont, sizemeasure, strformat, numchars, numlines)
stringfopage = stringtoprint.Substring(0, numchars)
ev.Graphics.DrawString(stringfopage, printfont, Brushes.Black, rectdraw, strformat)
x = Nothing
y = Nothing
ev.Graphics.Dispose()
ev.HasMorePages = False
End Sub
程序代码:
Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click
Try
PrintDocument1.DefaultPageSettings = printpagesettings
stringtoprint = RichTextBox4.Text
PrintDialog1.Document = PrintDocument1
PageSetupDialog1.PageSettings = printpagesettings
PrintDialog1.PrinterSettings.Copies = 1 ''打印的份数
If PrintDialog1.ShowDialog = DialogResult.OK Then
PageSetupDialog1.PageSettings.Landscape = True
If PageSetupDialog1.ShowDialog = DialogResult.OK Then
AddHandler PrintDocument1.PrintPage, AddressOf Me.printgraphicYDxukezheng
PrintDocument1.Print()
PrintDocument1.Dispose()
End If
End If
Catch ex As Exception
MessageBox.Show("打印出现错误", ex.ToString())
End Try
End Sub
程序代码:
Private Sub Button38_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button38.Click
Try
PrintDocument1.DefaultPageSettings = printpagesettings
stringtoprint = RichTextBox5.Text
PrintDialog1.Document = PrintDocument1
PageSetupDialog1.PageSettings = printpagesettings
PrintDialog1.PrinterSettings.Copies = 1 ''打印的份数
If PrintDialog1.ShowDialog = DialogResult.OK Then
PageSetupDialog1.PageSettings.Landscape = True
If PageSetupDialog1.ShowDialog = DialogResult.OK Then
AddHandler PrintDocument1.PrintPage, AddressOf Me.printgraphicxcxukezheng
PrintDocument1.Print()
PrintDocument1.Dispose()
End If
End If
Catch ex As Exception
MessageBox.Show("打印出现错误", ex.ToString())
End Try
End Sub
程序代码:
Private Sub Button42_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button42.Click
Try
PrintDocument1.DefaultPageSettings = printpagesettings
stringtoprint = RichTextBox6.Text
PrintDialog1.Document = PrintDocument1
PageSetupDialog1.PageSettings = printpagesettings
PrintDialog1.PrinterSettings.Copies = 1 ''打印的份数
If PrintDialog1.ShowDialog = DialogResult.OK Then
PageSetupDialog1.PageSettings.Landscape = False
If PageSetupDialog1.ShowDialog = DialogResult.OK Then
AddHandler PrintDocument1.PrintPage, AddressOf Me.printgraphicshenpi
PrintDocument1.Print()
PrintDocument1.Dispose()
End If
End If
Catch ex As Exception
MessageBox.Show("打印出现错误", ex.ToString())
End Try
End Sub
程序代码:
Private Sub Button43_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button43.Click
Try
PrintDocument1.DefaultPageSettings = printpagesettings
PrintDialog1.Document = PrintDocument1
PageSetupDialog1.PageSettings = printpagesettings
PrintDialog1.PrinterSettings.Copies = 1 ''打印的份数
PageSetupDialog1.PageSettings.Landscape = False
If PrintDialog1.ShowDialog = DialogResult.OK Then
If PageSetupDialog1.ShowDialog = DialogResult.OK Then
AddHandler PrintDocument1.PrintPage, AddressOf Me.printgraphictongzhidan
PrintDocument1.Print()
PrintDocument1.Dispose()
End If
End If
Catch ex As Exception
MessageBox.Show("打印出现错误", ex.ToString())
End Try
End Sub
这是部分代码,我看这足够了。这些代码全部在一个窗口里