NA
Nisha Arockiya A
Syncfusion Team
December 2, 2008 12:41 PM UTC
Hi Dmitry,
Thanks for your interest in Syncfusion Products.
The style AutoSize property only works as your user types text into a cell. If AUtoSize is et to true for a cell, the cell will grow as your user types longer words.
To programmatically size a column, you use the GridControl.ColWidths.ResizeToFit method. (Or, GridDataBoundGrid.Model.ColWidths.ResizeToFit).
So, after setting your titles, try code such as:
this.grid.ColWidths.ResizeToFit(GridRangeInfo.Row(0), GridResizeToFitOptions.None);
to resize row zero which are the column headers.
Let me know if this is not what you needed.
Regards,
Nisha
AD
Administrator
Syncfusion Team
December 11, 2008 12:26 PM UTC
Hi.
Thank you for your answer.
But I want to change column size in automatic mode when grid change its size. For example:
We have a Form and one GridControl on it.
GridControl.DockStyle = DockStyle.Fill.
Grid control has 3 columns: col1, col2, col3.
When user changes size of this form, size of grid control is changed either.
I want that col2 size and col3 size are not changed but col1 must fill all free space in grid control.
before:
col1 | col2 | col3 |
------+--------+-------+ -> user sizes form
| | |
after:
col1 | col2 | col3 |
-----------+--------+-------+
| | |
AD
Administrator
Syncfusion Team
December 11, 2008 12:29 PM UTC
I mean:
before:
__col1__|__col2__|__col3__|
after user changes the form:
________col1________|__col2__|__col3__|
NA
Nisha Arockiya A
Syncfusion Team
December 15, 2008 12:56 PM UTC
Hi
Thanks for being patience.
The GridControl.ColWidths.ResizeToFit method (or GridDataBoundGrid.Model.Colwidths.ResizeToFit) will resize a range of cells to fit.
To give an idea, inorder to resize the header is column 2, you would use something like
this.gridControl1.ColWidths.ResizeToFit(GridRangeInfo.Cell(0,2));
To resize all of column 2, you would use something like
this.gridControl1.ColWidths.ResizeToFit(GridRangeInfo.Col(2));
Please try and let me know any help you need.
Regards,
Nisha