Hola, no es dificil, lo que tenes que hacer es no pintar todas las rows, sino solo las visible esto acelera un 500% la funcion, la cuestion es que deves hacer cada vez que se dispara el evento MSFlexGrid1_Scroll , ademas en el Form_Load , y depsues de que ordenas, te doy un ejemplo.
Option Explicit
Private Sub Form_Load()
Agregar_Datos_FlexGrid
Call AltLVBackGroundFlex(MSFlexGrid1, RGB(255, 255, 255), RGB(230, 222, 253))
End Sub
Public Sub AltLVBackGroundFlex(Flex As Object, ByVal BackColorOne As OLE_COLOR, ByVal BackColorTwo As OLE_COLOR)
Dim Row As Long
Dim Col As Long
With MSFlexGrid1
.Redraw = False
For Row = .TopRow To .Rows - 1
If .RowIsVisible(Row) = False Then Exit For
.Row = Row
For Col = 0 To .Cols - 1
.Col = Col
If Row Mod 2 Then
.CellBackColor = BackColorTwo
Else
.CellBackColor = BackColorOne
End If
Next
Next
.Redraw = True
End With
End Sub
Private Sub MSFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
With MSFlexGrid1
If .MouseRow <> 0 Then
Exit Sub
End If
'La función retorna el tipo de orden, es decir esta declarada como As SortSettings
If Ordenar_Columna_FlexGrid(MSFlexGrid1, .MouseCol) = flexSortGenericAscending Then
Me.Caption = " FlexGrid en orden: Ascendente "
Else
Me.Caption = " FlexGrid en orden: Descendente "
End If
End With
MSFlexGrid1_Scroll
End Sub
Private Sub Agregar_Datos_FlexGrid()
Dim columna As Integer, i As Integer
MSFlexGrid1.Redraw = False
For i = 1 To 10000
MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
For columna = 0 To 3
MSFlexGrid1.TextMatrix(i, columna) = Numero_Aleatorio(1500, i)
Next
Next
MSFlexGrid1.Redraw = True
End Sub
'Función para generar valores aleatorios para insertar en el FlexGrid
Private Function Numero_Aleatorio(Upper As Integer, Lower As Integer) As Integer
Randomize
'Retornar el número a la función
Numero_Aleatorio = Int((Upper - Lower + 1) * Rnd + Lower)
End Function
Private Sub MSFlexGrid1_Scroll()
Call AltLVBackGroundFlex(MSFlexGrid1, RGB(255, 255, 255), RGB(230, 222, 253))
End Sub
Saludos.