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.

column width setting using ResizeToFit

Thread ID:

Created:

Updated:

Platform:

Replies:

39343 Jan 4,2006 05:41 PM Jan 5,2006 02:27 AM Windows Forms 1
loading
Tags: GridControl
Hui Zhong
Asked On January 4, 2006 05:41 PM

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 02:27 AM

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.

CONFIRMATION

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.

;