Adodc1.RecordSource = "SELECT * FROM table"
Adodc1.Refresh
DataGrid1_Refresh
end sub
private sub command1_click()
RowHeight = 200
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
CommonDialog1.ShowPrinter
For Num = 0 To Adodc1.Recordset.RecordCount - 1
DataGrid1.Row = Num
For Index = 0 To 24
DataGrid1.Col = Index
PrintText DataGrid1.Text, LeftStart + 160 + Lblwidth + Index * 800, TopStart + 1100 + (RowHeight + 200) * (Num + 3.7)
Next
Next
Printer.EndDoc
ErrHandler:
end sub
Sub PrintFont(tName As String, nSize As Integer, bBold As Boolean, bUnderline As Boolean, bItalic As Boolean)
Printer.FontName = tName
Printer.FontSize = nSize
Printer.FontBold = bBold
Printer.FontUnderline = bUnderline
Printer.FontItalic = bItalic
End Sub
Sub PrintText(tText As String, tx As Integer, ty As Integer)
Printer.CurrentX = tx
Printer.CurrentY = ty
Printer.Print tText
End Sub
Sub DataGrid1_Refresh()
DataGrid1.Columns(0).Width = 1300
DataGrid1.Columns(1).Width = 1000
DataGrid1.Columns(0).Caption = "文件ID"
DataGrid1.Columns(1).Caption = "分类"
end sub
For i = 1 To 5
If i = 1 Then
obj.DrawWidth = 2
Else
obj.DrawWidth = 1
End If
obj.Line (curX, curY)-(obj.ScaleWidth - 150, curY)
iBottomRight = curY
'~~~~~
adjRowHeight = obj.TextHeight("A") + 3
curY = curY + adjRowHeight + 4
Next