"Flicker" when updating cells in a "trader-like" real-time virtual grid
Hi,
I'm trying to get optimum performance for a frequently updating grid. Using your Trader grid example, I've implemented the DrawClippedGrid method for drawing updated cells. This works great as far as performance is concerned, but there's a "flicker" occasionally when a cell updates. On another thread, there was a reply that mentioned something about drawing the clipped grid to a bitmap, then drawing the bitmap to the grid (but no code). I've tried to implement this solution, but cannot get it working. I've attached the code I'm using:
DrawBitmapToGridCell.zip
I'm trying to get optimum performance for a frequently updating grid. Using your Trader grid example, I've implemented the DrawClippedGrid method for drawing updated cells. This works great as far as performance is concerned, but there's a "flicker" occasionally when a cell updates. On another thread, there was a reply that mentioned something about drawing the clipped grid to a bitmap, then drawing the bitmap to the grid (but no code). I've tried to implement this solution, but cannot get it working. I've attached the code I'm using:
DrawBitmapToGridCell.zip
SIGN IN To post a reply.
5 Replies
AD
Administrator
Syncfusion Team
November 1, 2006 05:58 AM UTC
Hi Erik,
The flickering problem can be avoided by calling the Refresh method between the BeginUpdate() and EndUpdate() calls.
grid.BeginUpdate();
////code///
grid.EndUpdate( false );
Let me know if this helps.
Best Regards,
Haneef
The flickering problem can be avoided by calling the Refresh method between the BeginUpdate() and EndUpdate() calls.
grid.BeginUpdate();
////code///
grid.EndUpdate( false );
Let me know if this helps.
Best Regards,
Haneef
EH
Erik Harris
November 1, 2006 03:04 PM UTC
Thanks for your reply, Haneef.
I'd like to avoid calling the "Refresh" method at all (for performance), which is why I'm using the DrawClippedGrid method for updating the cell.
If I wrap the DrawClippedGrid method call in the BeginUpdate - EndUpdate calls as you recommended, the flicker remains.
I was interested in the idea of drawing the clipped grid to a bitmap, then drawing the bitmap to the cell. Any sample code available for this option?
Thanks for your support.
Erik
I'd like to avoid calling the "Refresh" method at all (for performance), which is why I'm using the DrawClippedGrid method for updating the cell.
If I wrap the DrawClippedGrid method call in the BeginUpdate - EndUpdate calls as you recommended, the flicker remains.
I was interested in the idea of drawing the clipped grid to a bitmap, then drawing the bitmap to the cell. Any sample code available for this option?
Thanks for your support.
Erik
AD
Administrator
Syncfusion Team
November 2, 2006 05:43 AM UTC
Hi Erik,
Instead of CreateGridGraphics(), if you could use GetCachedGraphics() (ver. 4.1), there will be better performance.
Please refer to the attached sample that caches the graphics object across paint calls and disposes it only when the grid gets disposed or its size was changed. The only further improvement you can do is to set:
this.gridControl1.UseDoubleBuffer = false;
this.gridControl1.UseGDI = true;
Sample : http://www.syncfusion.com/Support/user/uploads/PerformanceGrid_dce3029d.zip
Best Regards,
Haneef
Instead of CreateGridGraphics(), if you could use GetCachedGraphics() (ver. 4.1), there will be better performance.
Please refer to the attached sample that caches the graphics object across paint calls and disposes it only when the grid gets disposed or its size was changed. The only further improvement you can do is to set:
this.gridControl1.UseDoubleBuffer = false;
this.gridControl1.UseGDI = true;
Sample : http://www.syncfusion.com/Support/user/uploads/PerformanceGrid_dce3029d.zip
Best Regards,
Haneef
EH
Erik Harris
November 2, 2006 09:00 PM UTC
Haneef,
Thanks again for your help.
With your suggestions, I've once again improved the performance of my grid.
Any suggestions for eliminating the flicker?
Erik
Thanks again for your help.
With your suggestions, I've once again improved the performance of my grid.
Any suggestions for eliminating the flicker?
Erik
AD
Administrator
Syncfusion Team
November 3, 2006 07:33 AM UTC
Hi Erik,
There is another way you can freeze the painting. This technique works for any control and is discussed in one of our WIndows Forms FAQ. It adds aFreezePainting property to teh class that you can turn on and off. This technque has worked in situations where BeginUpdate is being cancelled for special reasons. Here is a forum thread that has teh references to the FAQ and includes a sample of how to use it.
Maybe this technique will work for you.
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=9290
Thanks,
Haneef
There is another way you can freeze the painting. This technique works for any control and is discussed in one of our WIndows Forms FAQ. It adds aFreezePainting property to teh class that you can turn on and off. This technque has worked in situations where BeginUpdate is being cancelled for special reasons. Here is a forum thread that has teh references to the FAQ and includes a sample of how to use it.
Maybe this technique will work for you.
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=9290
Thanks,
Haneef
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
EH Erik Harris
- Nov 1, 2006 12:07 AM UTC
- Nov 3, 2006 07:33 AM UTC