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

Automatic Fit Columns to Grid Size

Thread ID:





84940 Jul 3,2009 12:32 PM UTC Jul 6,2009 12:55 PM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On July 3, 2009 12:32 PM UTC

Doese someone knows, how i can force the GridControl to automatically fit the size of all Columns to the size of the
Gridcontrol. So if the customer change the size of the grid, the columns where automatically fitted.


Rajadurai C [Syncfusion]
Replied On July 6, 2009 12:55 PM UTC

Hi Maytree,

Thanks for your interest in Syncfusion Products.

To resize the column width according to the grid' clientsize, try to handle the QueryColWidth event and set width for each column. This event get triggered each time, the column width is queried. Please refer to the following code.

void gridControl1_QueryColWidth(object sender, Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs e)
if (e.Index > 0)
int clientwidth = this.gridControl1.ClientRectangle.Width - (this.gridControl1.Model.ColWidths[0]);
e.Size = (int)(clientwidth / (float)this.gridControl1.Model.ColCount);
e.Handled = true;



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