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.
Unfortunately, activation email could not send to your email. Please try again.

How to resize column to best fit when double click at column header?

Thread ID:





32661 Aug 5,2005 03:42 AM Aug 5,2005 06:16 AM Windows Forms 1
Tags: GridControl
William Ng Cheng Piaw
Asked On August 5, 2005 03:42 AM

When double click on the line between 2 columns at the column header, the column will resize to a default size. How do I make it such that it will resize to the best fit (longest content in the column ) like in excel? Thanks.

Administrator [Syncfusion]
Replied On August 5, 2005 06:16 AM

There is no property that does this, but you can do it handling the ResizingCols event.
private void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
	if(e.Reason == GridResizeCellsReason.DoubleClick)
		this.gridControl1.ColWidths.ResizeToFit(e.Columns, GridResizeToFitOptions.IncludeHeaders);
		e.Cancel = 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.

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.