Redraw Property

Enables or disables redrawing of the VSFlexGrid control.

Syntax

[form!]VSFlexGrid.Redraw[ = RedrawSettings ]

Remarks

The settings for the Redraw property are described below:

 

Constant

Value

Description

FlexRDNone

0

The grid does not repaint itself.

FlexRDDirect

1

The grid paints its contents directly on the screen.
This is the fastest repaint mode, but there occasionally it may cause a little flicker.

FlexRDBuffered

2

The grid paints its contents on an off-screen buffer, then transfers the complete image to the screen. This mode is slightly slower than flexRDDirect, but it eliminates flicker.

True       

-1

Equivalent to flexRDDirect. This setting is allowed for compatibility with previous versions of the control.

 

The Redraw property is used in one of the main optimizations available to VSFlexGrid users. Before making extensive changes to the grid, set the Redraw property to flexRDNone to suspend repainting until you are done with the changes. Then restore Redraw to its previous setting. Doing this will reduce flicker and increase speed. This optimization is especially effective when adding large numbers of rows to the grid, because the control needs to recalculate the scroll ranges each time a row is added.

For example, the code below turns repainting off, changes to the contents of the control, and then turns repainting back on to show the results.

Sub UpdateGrid()

  fa.Redraw = flexRDNone ' suspend redrawing/avoid flicker

  fg.Rows = 1

  Dim i As Long

  For i = 1 To 10000

     fg.AddItem "Row " & i

  Next

  fg.Redraw = True       ' resume redrawing

End Sub

Data Type

RedrawSettings (Enumeration)

Default Value

flexRDDirect (1)

See Also

VSFlexGrid Control