| 发表于:2007-06-27 22:52:43 楼主 |
private sub showcls() '显示mshflexgrid dim hh as integer dim i as integer hh = 1 with grid1 .clear .backcolor = &hffffff .formatstring = "^ ¦^存货代码 ¦^类别编码 ¦^存货名称及规格 ¦^结存数量 ¦^结存金额 " .colwidth(0) = 500 .colwidth(1) = 1200 .colwidth(2) = 1500 .colwidth(3) = 4000 .colwidth(4) = 1800 .colwidth(5) = 2000 for i = 0 to 5 .colalignmentfixed(i) = 4 next i for i = 1 to 3 .colalignment = 1 next i for i = 4 to 5 .colalignment = 7 next i if rs.state <> adstateclosed then rs.close end if rs.cursorlocation = aduseclient '首先读取存货项目表 rs.open "select * from icitem order by fitemid ", cn, adopenkeyset, adlockpessimistic if rs.recordcount <> 0 then rs.movefirst .rows = rs.recordcount + 1 do until rs.eof .row = hh .col = 0 .text = hh .col = 1 .text = rs!fitemid .cellbackcolor = &hc0ffff '定义第2、3、4列的背景色为黄色,为以后是否能编辑定义,黄色不能修改 .col = 2 .text = rs!lbcode .cellbackcolor = &hc0ffff .col = 3 .text = rs!fitemname & " " & rs!fmodel .cellbackcolor = &hc0ffff .col = 4 .text = format(rs!fbegqty, "#,##0.00 ") .col = 5 .text = format(rs!fbegbal, "#,##0.00 ") hh = hh + 1 rs.movenext loop if hh = .rows then .rows = hh + 1 end if .textmatrix(hh, 0) = hh .textmatrix(hh, 1) = "合 计 " if rssum.state <> adstateclosed then rssum.close end if rssum.open "select sum(fbegbal) from icinitdata where left(fclsid, " & ijbcd & ")= ' " & left(schlb, ijbcd) & " ' and fstockid= " & ick & " ", cn, adopenkeyset, adlockpessimistic .col = 5 .text = format(rssum.fields(0), "#,##0.00 ") for i = 1 to 5 .row = hh .col = i .cellbackcolor = &hc0ffff '最后一行全为黄色,即单元格不能编辑 next i else .backcolor = &hc0ffff .rows = rs.recordcount + 2 end if rs.close .redraw = false .backcolorfixed = rgb(190, 218, 178) '定义固定表头的背景色 .redraw = true end with end sub 这段代码执行下来的时候,记录少的话还可以,但是如果比较多的话,显示出来就非常慢(100条以内都慢),有没有能使显示速度快一点的办法! |
|
|
|
|