【正文】
alue, , , PrintLeft, PrintTop) (, PrintLeft, PrintTop, CellWidth, Cellheight) PrintLeft = PrintLeft + (i).Width Next PrintHeight = PrintHeight + (j).Height PrintTop = PrintTop + (j).Height j = j + 1 If PrintHeight = Then Exit Do End If Loop If j = 1 Then = True Else = False j = 0 End If End If End Sub Private Sub ButtonQuXiao_Click(ByVal sender As , ByVal e As ) Handles () End Sub End Class 讀者查詢打印窗體代碼 : Public Class FormDuZheChaXunDaYin Public biaozi As Boolean Private Sub ButtonYeMianSheZhi_Click(ByVal sender As , ByVal e As ) Handles = PrintDocument1 () End Sub Private Sub ButtonYuLan_Click(ByVal sender As , ByVal e As ) Handles = PrintDocument1 () End Sub Private Sub ButtonDaYin_Click(ByVal sender As , ByVal e As ) Handles = PrintDocument1 = True = True = True If = Then () End If End Sub Private Sub ButtonYeMeiJiao_Click(ByVal sender As , ByVal e As ) Handles () End Sub Private Sub ButtonQuXiao_Click(ByVal sender As , ByVal e As ) Handles () End Sub Private Sub PrintDocument1_PrintPage(ByVal sender As , ByVal e As ) Handles Dim w, h, x, y As Integer Dim PrintHeight As Integer Dim PrintLeft, PrintTop As Integer Dim CellWidth, Cellheight As Integer Dim i As Integer Dim k As Integer Static j As Integer If biaozi = True Then If Then w = h = y = h / 2 / 2 x = w / 2 ( * ) / 2 (, , , x, y) End If If Then w = h = y = h / 2 / 2 + x = w / 2 ( * ) / 2 (, , , x, y) End If PrintTop = PrintLeft = For k = 0 To 1 ((k).HeaderText, , , PrintLeft, PrintTop) CellWidth = (k).Width Cellheight = (, PrintLeft, PrintTop, CellWidth, Cellheight) PrintLeft = PrintLeft + (k).Width Next PrintTop = PrintTop + PrintHeight = 39。i列下標(biāo)的變化范圍 , j行下標(biāo)的變化范圍 Do While j = 1 PrintLeft = Cellheight = (j).Height For i = 0 To 1 CellWidth = (i).Width ((j).Cells(i).Value, , , PrintLeft, PrintTop) (, PrintLeft, PrintTop, CellWidth, Cellheight) PrintLeft = PrintLeft + (i).Width Next PrintHeight = PrintHeight + (j).Height PrintTop = PrintTop + (j).Height j = j + 1 If PrintHeight = Then Exit Do End If Loop If j = 1 Then = True Else = False j = 0 End If Else If Then w = h = y = h / 2 / 2 x = w / 2 ( * ) / 2 (, , , x, y) End If If Then w = h = y = h / 2 / 2 + x = w / 2 ( * ) / 2 (, , , x, y) End If PrintTop = PrintLeft = For k = 0 To 1 ((k).HeaderText, , , PrintLeft, PrintTop) CellWidth = (k).Width Cellheight = (, PrintLeft, PrintTop, CellWidth, Cellheight) PrintLeft = PrintLeft + (k).Width Next PrintTop = PrintTop + PrintHeight = 39。i列下標(biāo)的變化范圍 , j行下標(biāo)的變化范圍 Do While j = 1 PrintLeft = Cellheight = (j).Height For i = 0 To 1 CellWidth = (i).Width ((j).Cells(i).Value, , , PrintLeft, PrintTop) (, PrintLeft, PrintTop, CellWidth, Cellheight) PrintLeft = PrintLeft + (i).Width Next PrintHeight = PrintHeight + (j).Height PrintTop = PrintTop + (j).Height j = j + 1 If PrintHeight = Then Exit Do End If Loop If j = 1 Then = True Else = False j = 0 End If End If End Sub End Class 讀者查找窗體代碼 : Imports Public Class FormDuZheChaZhao Private Sub FormDuZheChaZhao_Shown(ByVal sender As Object, ByVal e As ) Handles = True End Sub Private Sub ButtonFanHui_Click(ByVal sender As Object, ByVal e As ) Handles () End Sub Private Sub ButtonChaZhao_Click(ByVal sender As Object, ByVal e As ) Handles If And Then Dim sqlm As New SqlCommand = sqlconn If = True Then = select * from DuZheXinXi where amp。 amp。 =39。 amp。 amp。 39。 Else = select * fr