We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Flashing Of Grid During Scroll

What is happening is the grid is scrolling to the new position. Once there the entire grid redraws using the grid level style, then the cell level draw happens. Is there a way to trigger a refresh without erasing previous contents of the grid?

3 Replies

AD Administrator Syncfusion Team October 6, 2004 01:24 PM UTC

Do you have something special like a Bitmap backgrounds or transparent backgrounds? The reason I ask is that depending what you mean by scrolling, the grid normally does not erase background, and only draws things cell by cell. There is ''no grid level style'' drawing normally. Can you see this behavior in any of our samples? Are you scrolling 1 row at the time (holding down the scrollbar button)? If so, the default behavior of teh grid is to do a WindowScrolll to just scroll the existing window for all but the newly exposed row, and then to paint only the new row. So, the Paint event should only be called once and the DrawCell event should only be raised for each cell in teh new row. Also, DrawCellBackground should only be raised for teh new row (& may not eaven be raised cell by cell for teh new row, but just once for teh whole row depending on the actual cell backgrounds.) If you are scrolling by paging the scrollbar, then the whole grid is redrawn is redrawn in this case. But even in this case, the grid is double bufferred and the drawing is smooth. If you want to turn off the drawing of the cell background, you can handle the DrawCellBackground event, and set e.Cancel = true.


AD Administrator Syncfusion Team October 6, 2004 02:35 PM UTC

What happens is that the text is being updated from an external source. Here is the work flow. When the user scrolls down, the grid moves down one row. When the top row is exposed it is drawn using the style for the grid, which is a blank row. Then the processing occurs that fills in the row with valid data. This sequence appears a a flicker. Is there a way to have the window scroll, without really redrawing yet. And then redraw the contents of the cells, without redrawing the blanks cells. Or to surpress the drawing of the new row until the data has arrived. The kind of remember doing this in windows by overriding on erase background. Thanks.


AD Administrator Syncfusion Team October 6, 2004 02:55 PM UTC

I think the best results might be trying to make sure the grid has the data you want to see before the single row is scrolled. (This is likely to be the simplest thing to get done as well). That way the grid will not draw a blank row, but instead will draw the proper values the first time, and you will not see the blank row. Can you populate the single row above the toprow before the row is visible using whatever processing you need to do? In this manner, the data would be available to the grid on the first pass and you woul dnot see the blank row. Can you use the grid in a virtual manner? This is the normal way to handle dynamic data. In this case, you would use the QueryCellInfo event to set e.Style.CellValue based on e.ColIndex and e.RowIndex (using whatever processing you need to do). If this processing is time consuming, then you may want to cache a set values, and provide the values in QueryCellInfo from this cache (only doing the time consuming work occassionlly as the grid moves close to a boundary of your cash). If you do not want to draw the row, you can handle the DrawCellBackgound and DrawCell events and conditionally set e.Cancel = true for the cells you do not want to draw.

Loader.
Live Chat Icon For mobile
Up arrow icon