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

Huge problem: Dangerous increase of GDI objects when using virtual grid

Hi,

Run the traderGridTest example and monitor the GDI objects used by this application in the Windows Task Manager.
Keep on resizing the traderGridTest window: nothing happens

Now, add the simple line between arrows below, in m_syncGrid_QueryCellInfo:

...
// Retrieve the cell value
object[] row = (object[]) m_set[e.RowIndex-1];
e.Style.CellValue = row[e.ColIndex-1];
-----> e.Style.Font.Bold = true; <-------
e.Handled = true;
...

Run and keep on resizing... The GDI objects rises continuously and if it reaches 10000 the application craches.

Any ideas how to keep the GDI number low ?
My guess is that resizes trigger updates that trigger ResetVolatileData but I don't know how to resolve my problem.

Thank you for your help.

4 Replies

AD Administrator Syncfusion Team March 21, 2007 09:04 PM UTC

Hi Ivan,

Please refer to the RefreshGrid ( \Syncfusion\Essential Studio\4.4.0.49\windows\Grid.Windows\Samples\PerformanceSamples\RefreshGrid\cs ) browser sample that caches the graphics object across paint calls and disposes it only when the grid gets disposed or its size was changed. It also implements a GDI or a GDI+ to manage the drawing of texts and backgrounds. In some situations, it would be more efficient to use a GDI drawing. This is implemented by the derived grid in the OnDrawCellDisplayText and the OnFillRectangleHook overrides. It uses a call to static helper methods in the library code that access the GDI routines through the interop.

Best regards,
Haneef


IC Ivan Capin March 22, 2007 10:23 AM UTC

Hello Haneef,

I am sorry but I am not very pleased by this answer. We have bought 4 Syncfusion licences and we have already developed a quite important application that includes virtual grids and that is used by traders on a daily basis. We are not going to drop our virtual grids just because it is not possible to display BOLD caracters on it (the example I gave is blatant) !!!
Please try to cater a satisfactory answer or the details of someone that can.
I am sorry to be that harsh but we have an application with a bug coming from your code and we absolutly need a solution.

Regards

>Hi Ivan,

Please refer to the RefreshGrid ( \Syncfusion\Essential Studio\4.4.0.49\windows\Grid.Windows\Samples\PerformanceSamples\RefreshGrid\cs ) browser sample that caches the graphics object across paint calls and disposes it only when the grid gets disposed or its size was changed. It also implements a GDI or a GDI+ to manage the drawing of texts and backgrounds. In some situations, it would be more efficient to use a GDI drawing. This is implemented by the derived grid in the OnDrawCellDisplayText and the OnFillRectangleHook overrides. It uses a call to static helper methods in the library code that access the GDI routines through the interop.

Best regards,
Haneef


AD Administrator Syncfusion Team March 22, 2007 01:34 PM UTC

Hi Ivan,

Please refer this KB article for more details.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=352

Best regards,
Haneef


IC Ivan Capin March 22, 2007 02:52 PM UTC

That's perfect, it works. Thank you very much Haneef.

>Hi Ivan,

Please refer this KB article for more details.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=352

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon