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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ResizeToFit performance issue

Thread ID:





91813 Dec 3,2009 02:54 PM UTC Dec 7,2010 01:07 PM UTC WinForms 4
Tags: Grouping
Christian Rattat
Asked On December 3, 2009 02:54 PM UTC


I currently resize all columns of tables and nested tables in ggc what takes a lot of time when many rows are loaded. Is there a possibility to call resizetofit on columns and consider only the visible rows to measure column widths?

We are still on version 4.2.

Thanks in advance,

Jisha Joy [Syncfusion]
Replied On December 8, 2009 06:26 AM UTC

Hi Christian,

Thank you for posting query to us.

You could resize specific columns alone by specifying the column index in the GridRangeInfo.Col method, as argument.


Please let me know if this helps.


Ranjeet Kumar [Syncfusion]
Replied On December 8, 2009 09:42 AM UTC

Hi Christian,

Thanks for using Syncfusion Products.

Yes, there is possibility to call resizetofit on columns and consider only the visible rows to measure column widths by passing the last visible row index and topmost row

index as arguments to ResizeToFit method. Please, refer the sample attached for its implementation and for additional GridGrouping Control optimization settings:

this.gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Rows(this.gridGroupingControl1.TableControl.TopRowIndex, this.gridGroupingControl1.TableControl.ViewLayout.LastVisibleRow));

Please find the sample from the following link in which this code has been implemented.


Additionally to optimize the grid performance , you may set the following settings as shown below :

This optimization setting will help you to enhance the performance of the GridGrouping Control by utilizing less memory and so on.

// This will ensure that grid's painting routine draw all the cells with same background at one time rather than one cell at a time.
this.gridGroupingControl1.TableControl.OptimizeDrawBackground = true;

// This ensures the better memory utilization
this.gridGroupingControl1.CounterLogic = EngineCounters.YAmount;

this.gridGroupingControl1.AllowedOptimizations = EngineOptimizations.DisableCounters | EngineOptimizations.RecordsAsDisplayElements;

// Scrollwindow will cause immediate update.
this.gridGroupingControl1.InsertRemoveBehavior = GridListChangedInsertRemoveBehavior.ScrollWithImmediateUpdate;

this.gridGroupingControl1.SortPositionChangedBehavior = GridListChangedInsertRemoveBehavior.ScrollWithImmediateUpdate;

this.gridGroupingControl1.Engine.InvalidateAllWhenListChanged = false;

Please, do let me know if you have any query.


Christian Rattat
Replied On December 3, 2010 05:08 PM UTC


I'm still having problems with resizing columns to fit their content. Even if I do ResizeToFit only for the first row it takes 5 seconds when having 10000 rows in the table. This takes more time than loading the data into the grid.

I changed to version 8.2 meanwhile but the problem remains. Any ideas how to get this faster?


Yuvaraja V [Syncfusion]
Replied On December 7, 2010 01:07 PM UTC

Hi Christian,

Thanks you for your update.

There are some standard optimizations that need to be set, to increase the performance while using large amount of data with frequently updates in GridGroupingControl. See the following optimization code:

// Use less memory for internal binary tree structures
gridGroupingControl1.CounterLogic = EngineCounters.YAmount;
gridGroupingControl1.AllowedOptimizations = EngineOptimizations.DisableCounters | EngineOptimizations.RecordsAsDisplayElements;

// Affected settings by UseDefaultsForFasterDrawing are: InvalidateAllWhenListChanged, TableOptions.ColumnsMaxLengthStrategy, TableOptions.GridLineBorder,TableOptions.DrawTextWithGdiInterop, TableOptions.VerticalPixelScroll,Appearance.AnyRecordFieldCell.WrapText and Appearance.AnyRecordFieldCell.Trimming.
gridGroupingControl1.UseDefaultsForFasterDrawing = true;

// Instruct grouping control not to access datasource through CurrencyManager API and instead access list diretly. When set to false you wil however loose support for built-in CurrencyManager synchronization, so only do this if you don't need CurrencyManager synchronization.
gridGroupingControl1.BindToCurrencyManager = false;

// Update display with changes, optionally use ScrollWindow for insert and removing rows.
//gridGroupingControl1.UpdateDisplayFrequency = 0; // only manual updates (when you call grid.Update)
gridGroupingControl1.UpdateDisplayFrequency = 1; // immediate update after each ListChanged.
//gridGroupingControl1.UpdateDisplayFrequency = 100; // update every 100 ms.
gridGroupingControl1.InsertRemoveBehavior = GridListChangedInsertRemoveBehavior.ScrollWithImmediateUpdate; // Scrollwindow will cause immediate update.
gridGroupingControl1.SortPositionChangedBehavior = GridListChangedInsertRemoveBehavior.ScrollWithImmediateUpdate; // Scrollwindow will cause immediate update.

// Don't forget this property. If it is true then InsertRemoveBehavior and SortPositionChangedBehavior properties would have no effect at all. Its default value is false if UseDefaultsForFasterDrawing = true has been set, but setting it explictly makes sure this is false.
gridGroupingControl1.InvalidateAllWhenListChanged = false;

You could refer the following sample from sample browser for more details:

Please let me know if this helps.

Yuvaraja V.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon