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

double click on header boundary to make column max width

Thread ID:





39349 Jan 5,2006 04:00 AM UTC Jan 6,2006 05:08 PM UTC WinForms 2
Tags: GridControl
Asked On January 5, 2006 04:00 AM UTC

I am using a gridcontrol and was wondering of it could do the following: In Excel, if you double click on the right boundary of a column header, the column expands to fit the max width of the largest entry in that column. If you double click on the same column boundary again, it goes back to the default width it was before. Is this available by default in the grid or would you have any sample code which may do this?

Administrator [Syncfusion]
Replied On January 5, 2006 12:58 PM UTC

Hi Va, you can try this code in ResizingColumns EventHandler int row,col; this.gridControl1.PointToRowCol(e.Point, out row, out col); if(e.Reason == Syncfusion.Windows.Forms.Grid.GridResizeCellsReason.DoubleClick) { if(this.gridControl1.DefaultColWidth == this.gridControl1.ColWidths[col]) { this.gridControl1.Model.ColWidths.ResizeToFit(e.Columns,GridResizeToFitOptions.ResizeCoveredCells); e.Cancel = true; } } Refer to Sample for more details Let me know if you need futher assistance. Regards, Madhan.


Replied On January 6, 2006 05:08 PM UTC

This was great. thank you.


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