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

double click on header boundary to make column max width

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?

2 Replies

AD Administrator Syncfusion Team 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.

DoubleClick.zip


VA va January 6, 2006 05:08 PM UTC

This was great. thank you.

Loader.
Live Chat Icon For mobile
Up arrow icon