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.

Grid: Autosize during initiaisation

Thread ID:

Created:

Updated:

Platform:

Replies:

49529 Sep 20,2006 02:35 PM Sep 22,2006 02:20 AM Windows Forms 3
loading
Tags: GridControl
Andreas Gfeller
Asked On September 20, 2006 02:35 PM

I''ve a problem with autosize feature in colums. When autosize is true, the column resizes perfectly when entering text in cells. So far, so good.

But there are two problems I''ve not found how to solve them:

First: When initializing a group of cells in a column, the column width does not fit to the largest text in that column. It remains at default width until I''m manually adding some text.

Second: The cell width does increase when entering text manually. But when text becomes shorter again, the width does not reduce.

How can I do this? Is Autosize the right feature implementing those things?

Thanks in advance
Andreas

Administrator [Syncfusion]
Replied On September 21, 2006 03:46 AM

Hi Andreas,

1. In the Form Load, call the ResizeToFit() method to make all the column widths get adjusted to its cell contents.

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

2. Try the code below in the TableControlCurrentCellChanged event handler to dynamically adjust the column width while entering text.

//
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(cc.RangeInfo, GridResizeToFitOptions.None);
//

Let me know if this helps for you.
Regards,
Rajagopal

Administrator [Syncfusion]
Replied On September 22, 2006 02:19 AM

That works perfectly!

Many thanks
Andreas

Andreas Gfeller
Replied On September 22, 2006 02:20 AM

That works perfectly!

Many thanks
Andreas

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.

;