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

column width setting using ResizeToFit

Thread ID:





39343 Jan 4,2006 10:41 PM UTC Jan 5,2006 07:27 AM UTC WinForms 1
Tags: GridControl
Hui Zhong
Asked On January 4, 2006 10:41 PM UTC

We use this.Model.ColWidths.ResizeToFit(GridRangeInfo.Rows(0, 100), GridResizeToFitOptions.IncludeHeaders) to set the column width automatically, however, we still need to add more space for the width of header cell. It''s possible to get it by setting the border like: this.RowStyles[0].BorderMargins.Right = 20;this.RowStyles[0].BorderMargins.Left = 20; Thanks.

Administrator [Syncfusion]
Replied On January 5, 2006 07:27 AM UTC

Hi Hui, BorderMargins are for cell''s internal borders. If the border margin is set for an editable cell then effect can be seen in the current cell''s border. this.gridDBG.Model.ColStyles[1].BorderMargins.Right = 20; To size the column beyond its default width, then you may use ColWidths properties or handle in QueryColWidth handler, but to use Colwidths property, AllowResizeToFit has to be set to false. private void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e) { if(e.Index == this.grid.Binder.NameToColIndex("columnName")) { e.Size = 100; e.Handled = true; } } Also refer this KB: http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=304 to see if that helps. Regards, Calvin.


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