】
For i = 1 To oRs.RecordCount
MSFlexGrid1.TextMatrix(i + 1, 0) = i Next
If (n > 0) Then
oRs.MoveFirst i = 0
End If 【显示编号下方的信息为从第2行、第0列为1,第3行第0列为2,i的取值为从1到查询到的数目oRs.RecordCount】 Do While Not oRs.EOF
n = n + 1
ylp = Int(ylp * 10 ^ 3 + 0.5) / (10 ^ 3)
wdp = Int(wdp * 10 ^ 3 + 0.5) / (10 ^ 3) llp = Int(llp * 10 ^ 3 + 0.5) / (10 ^ 3) zlp = Int(zlp * 10 ^ 3 + 0.5) / (10 ^ 3) dyp = Int(dyp * 10 ^ 3 + 0.5) / (10 ^ 3) sdp = Int(sdp * 10 ^ 3 + 0.5) / (10 ^ 3) i = i + 1
'MSFlexGrid1.AddItem i,i+1
t = CStr(oRs.Fields(0).Value) If e = f Then
MSFlexGrid1.TextMatrix(i + 1, 1) = Mid(t, 11, 16) End If
If e <> f Then
MSFlexGrid1.TextMatrix(i + 1, 1) = t End If
a1 = CStr(oRs.Fields(1).Value) b1 = CStr(oRs.Fields(2).Value) c1 = CStr(oRs.Fields(3).Value) d1 = CStr(oRs.Fields(4).Value) e1 = CStr(oRs.Fields(5).Value) f1 = CStr(oRs.Fields(6).Value)
a1 = Int(a1 * 10 ^ 3 + 0.5) / (10 ^ 3) b1 = Int(b1 * 10 ^ 3 + 0.5) / (10 ^ 3) c1 = Int(c1 * 10 ^ 3 + 0.5) / (10 ^ 3) d1 = Int(d1 * 10 ^ 3 + 0.5) / (10 ^ 3) e1 = Int(e1 * 10 ^ 3 + 0.5) / (10 ^ 3) f1 = Int(f1 * 10 ^ 3 + 0.5) / (10 ^ 3) MSFlexGrid1.TextMatrix(i + 1, 2) = a1 MSFlexGrid1.TextMatrix(i + 1, 3) = b1 MSFlexGrid1.TextMatrix(i + 1, 4) = c1 MSFlexGrid1.TextMatrix(i + 1, 5) = d1 MSFlexGrid1.TextMatrix(i + 1, 6) = e1 MSFlexGrid1.TextMatrix(i + 1, 7) = f1
MSFlexGrid1.TextMatrix(oRs.RecordCount + 3, 2) = yld MSFlexGrid1.TextMatrix(oRs.RecordCount + 4, 2) = ylx MSFlexGrid1.TextMatrix(oRs.RecordCount + 5, 2) = ylp MSFlexGrid1.TextMatrix(oRs.RecordCount + 3, 3) = wdd MSFlexGrid1.TextMatrix(oRs.RecordCount + 4, 3) = wdx MSFlexGrid1.TextMatrix(oRs.RecordCount + 5, 3) = wdp MSFlexGrid1.TextMatrix(oRs.RecordCount + 3, 4) = lld MSFlexGrid1.TextMatrix(oRs.RecordCount + 4, 4) = llx MSFlexGrid1.TextMatrix(oRs.RecordCount + 5, 4) = llp
'************************************************* MSFlexGrid1.TextMatrix(oRs.RecordCount + 3, 5) = zld MSFlexGrid1.TextMatrix(oRs.RecordCount + 4, 5) = zlx MSFlexGrid1.TextMatrix(oRs.RecordCount + 5, 5) = zlp MSFlexGrid1.TextMatrix(oRs.RecordCount + 3, 6) = dyd MSFlexGrid1.TextMatrix(oRs.RecordCount + 4, 6) = dyx MSFlexGrid1.TextMatrix(oRs.RecordCount + 5, 6) = dyp MSFlexGrid1.TextMatrix(oRs.RecordCount + 3, 7) = sdd MSFlexGrid1.TextMatrix(oRs.RecordCount + 4, 7) = sdx MSFlexGrid1.TextMatrix(oRs.RecordCount + 5, 7) = sdp '*****************************************************
oRs.MoveNext Loop
End Sub
3 打印按钮
Sub OnClick(ByVal Item) Dim ExcelApp Dim ExcelBook Dim ExcelSheet Dim MSFlexGrid1 Dim i,irow,ICOL Dim z,k
Set MSFlexGrid1 = ScreenItems(\Set ExcelApp = CreateObject(\Set ExcelBook = ExcelApp.Workbooks.Add Set ExcelSheet = ExcelBook.Worksheets(1) ExcelApp.Visible = True
ExcelSheet.Range(\
For irow = 0 To MSFlexGrid1.Rows - 1 For ICOL = 0 To MSFlexGrid1.Cols - 1 z=MSFlexGrid1.Rows
ExcelSheet.Cells(irow + 1,icol+1)=Trim(MSFlexGrid1.TextMatrix(irow, icol)) Next Next
ExcelSheet.Range( \ExcelSheet.Range( \ExcelSheet.Range( \ExcelSheet.Range( \ExcelSheet.Rows(1).RowHeight = 0.75/0.035 ExcelSheet.Cells.EntireColumn.AutoFit ExcelSheet.Rows(1).Font.Name = \宋体\ExcelSheet.Rows(1).Font.Bold = True ExcelSheet.Rows(1).Font.Size = 16
ExcelSheet.Cells.HorizontalAlignment =3 'ExcelSheet.PageSetup.TopMargin = 2/0.035 'ExcelSheet.PageSetup.BottomMargin = 2/0.035 'ExcelSheet.PageSetup.LeftMargin = 2/0.035 'ExcelSheet.PageSetup.RightMargin = 2/0.035
ExcelSheet.PageSetup.CenterHorizontally = 2/0.035 ExcelSheet.printpreview'打印阅览 'ExcelSheet.PrintOut'打印时用此句 ExcelBook.Close ExcelApp.Quit
Set ExcelApp = Nothing End Sub
4 画面函数 打开画面
Sub OnOpen() Dim Text1,Text2
Set Text1 = ScreenItems(\Set Text2 = ScreenItems(\Text1.Text=Now Text2.Text=0 End Sub