我这个赛扬450,内存128只需要10秒左右,你看看
'In the module
Option ExplicitPublic Enum sPlace
    rrLeft = 0
    rrcenter = 1
    rrright = 2
End EnumConst RowBkColorFixed = 13539939        'RGB(99, 154, 206)
Const RowBkColorOdd = 15715237          'RGB(165, 203, 239)
Const RowBkColorEven = 16772062         'RGB(222, 235, 255)
Const RowBkColorSel = &HFFFFFFPublic Sub SetGrdBgColor(Grd As MSHFlexGrid, Optional ByVal mPlace As sPlace)
    Dim i As Long
    Dim j As Long
    Dim k As Long
    Dim pRows As Long
    Dim pCols As Integer    pRows = 1 'grd.FixedRows
    pCols = Grd.Cols - 1
    Grd.Redraw = False    For i = 0 To pRows - 1
        Grd.Row = i
        For j = 0 To pCols
            Grd.Col = j
            Grd.CellBackColor = RowBkColorFixed
        Next j
    Next i
    
    For i = pRows To Grd.Rows - 1
        Grd.Row = i
        If (i - pRows) Mod 2 = 0 Then
            k = RowBkColorOdd
        Else
            k = RowBkColorEven
        End If
        For j = 0 To pCols
            Grd.Col = j
            Grd.CellBackColor = k
                If Not IsMissing(mPlace) Then
                    If mPlace = rrLeft Then '置左
                        Grd.CellAlignment = flexAlignLeftCenter
                    ElseIf mPlace = rrcenter Then '置中
                        Grd.CellAlignment = flexAlignCenterCenter
                    ElseIf mPlace = rrright Then
                        Grd.CellAlignment = flexAlignRightCenter
                    End If
                End If
        Next j
    Next i
    Grd.Refresh
    Grd.Redraw = True
End SubPublic Sub SetGrdSelColor(Grd As MSHFlexGrid)
    Grd.BackColorSel = RowBkColorSel
End Sub
'在窗体那放置一个MSHFlexGrid,调用SetGrdBgColor。
Such As:
Private Sub Command1_Click()
Grd.Rows = 10000
Grd.Cols = 20
SetGrdBgColor Grd, rrcenter
End Sub

解决方案 »

  1.   

    我试过了,你用的是msHFlexGrid,在我的机器上不到2秒,但改成msFlexGrid仍然是70秒。我就不明白了,同是微软的产品,为什么效率的差距就这么大呢?
      

  2.   

    用msHflexgrid,vb6就是要把msflexgrid淘汰。
    他们都不是微软做的,顶多别人帮它OEM
    我用msHflexgrid如果,flexgrid.redraw=false的时候,cell的变化过程看不到的,顶多过了90秒以后,才把表显示出来
      

  3.   

    我是你说的楼主
    我的问题有两个:
    图片问题,用.redraw = false解决了
    显示问题,是用msfgGrid.TextMatrix(x, y) = strText解决的
         不要用设置x,y后,再用  msfgGrid.Text = strText
    不过我的数量是"千"级,不是很大.希望有所帮助.
      

  4.   

    guesttwo:但是cellbackcolor必须先设置x,y啊
      

  5.   

    应该没有问题吧,就是不要用
    msfgGrid.Text = strText
    而用
    msfgGrid.TextMatrix(x, y) = strText
    如果设置背景的话就用.redraw = false
      

  6.   

    换成mshflexgrid吧,msflexgrid我从来没用过。
      

  7.   

    我试了你的源码,果然速度很慢.不过可以这样解决:
    把MSFlexGrid的横向滚动条保留,纵向用自己的滚动条代替
    读入数据时全部读入到内存中,每次显示grid.height/grid.fontheight个,
    通过控制自己的滚动条来控制数据
    这样在GRID中最多只有几十条数据,速度会非常快的.