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

auto-fit column width and auto-wrap to multiple rows

Thread ID:





60033 Apr 26,2007 03:36 PM UTC Apr 26,2007 05:19 PM UTC WinForms 1
Tags: GridControl
Lan Mo
Asked On April 26, 2007 03:36 PM UTC

V4.4.0.51 & VS2003

In form with GGC, there are situation with a lot of columns such as 30 fields(or columns) for a record. I want to add two option buttons to automatically to change the grid layout.

1. button for Auto-fit-content width
click this button, it will automatically to adjust all columns' width to fit its content.

2. button for Auto-Wrap-to-multiple- rows
click this button, first, it will adjust all columns' width to fit its content. then it will wrap a record row to multiple lines to make all columns visible.

Do you have any built-in property or methed to this? Any samples?



haneefm [Syncfusion]
Replied On April 26, 2007 05:19 PM UTC

Hi Lan,

Issue 1:

You can try this code snippet to resize the column-width to fit its content

this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(GridRangeInfo.Table(),GridResizeToFitOptions.GridResizeToFitOptions.IncludeHeaders );

Issue 2:
One comment is that by default, the GridGroupingControl does not support rows with individualized rowheights. To get this support, you need to add a custom GridEngine as in the ResizableRows browser sample( \Essential Studio\\windows\Grid.Grouping.Windows\Samples\FeatureSamples\ResizableRows ). The ResizableRows browser sample also shows you how to implement the IGridRowHeight interface and its routines for getting and setting row heights for elements.

Once you have this, then you can call TableControl.Model.RowHeights.ResizeToFit to handle either of these cases. Here is a little sample.

Best regards,


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