Hi,
Note :[ggAssetView == gridGroupingControl]
Private void ggdAssetView_TableControlResizingRows(object sender, GridTableControlResizingRowsEventArgs e) {
if(e.Inner.Reason == GridResizeCellsReason.DoubleClick) {
this.ggdAssetView.SyncfusionGridControl.TableControl.Model.RowHeights.ResizeToFit(GridRangeInfo.Table());
e.Inner.Cancel = true;
}
}
The Above event, i am using for resizing rows in grid grouping control.
For example: Col size =20
If u enter the more char then dbl click col header it gets resized to correct col width.
Then, reduce the char which present in the column then do the same thing it is not resizeing but it remains same width.
Simply says if u increse the char then resize it will work, the other way around is not working.
Thanks, Anna
AD
Administrator
Syncfusion Team
June 21, 2005 07:55 AM UTC
Are you trying to adjust the column width or the row height?
If you want to change the column width, use .Model.ColWidths.ResizeToFit instead of .Model.RowHeights.ResizeToFit.
AS
Anna Srinivasan
June 21, 2005 10:19 AM UTC
Hi,
I have attached the example for resizing cols and rows.
Q1: In that example, Resizing rows is working fine.In resizing columns once i expand the column even if i dbl click the col header i am not able to get the original col width.
Q2: While pressing Ctrl+A all the record which present in the grid grouping control gets selected. In this, How do i explicity set the selection color (By default it is comming dark blue)
GridGroupingControl_3994.zip
AD
Administrator
Syncfusion Team
June 21, 2005 10:47 AM UTC
1)Try this code.
private void gridGroupingControl1_TableControlResizingColumns(object sender, GridTableControlResizingColumnsEventArgs e) {
if(e.Inner.Reason == GridResizeCellsReason.DoubleClick)
{
int field = e.TableControl.Table.TableDescriptor.ColIndexToField(e.Inner.Columns.Right);
e.TableControl.Table.TableDescriptor.Columns[field].ResetWidth();
e.Inner.Cancel = true;
}
}
2) Try setting this property:
this.gridGroupingControl1.TableOptions.SelectionBackColor = Color.LightGoldenrodYellow;
AS
Anna Srinivasan
June 21, 2005 12:00 PM UTC
Hi,
Thanks, Color property is working fine.
But problem in resizing,
Once you modified the field you need to change the cursor focus to some other field then only your code will work otherwise it wont work.
Solution.?
Thanks, Anna
AD
Administrator
Syncfusion Team
June 21, 2005 02:13 PM UTC
You can end the edit.
private void gridGroupingControl1_TableControlResizingColumns(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlResizingColumnsEventArgs e) {
if(e.Inner.Reason == GridResizeCellsReason.DoubleClick)
{
if(e.TableControl.CurrentCell.IsEditing)
{
e.TableControl.Table.EndEdit();
}
int field = e.TableControl.Table.TableDescriptor.ColIndexToField(e.Inner.Columns.Right);
e.TableControl.Table.TableDescriptor.Columns[field].ResetWidth();
e.Inner.Cancel = true;
}
}
AS
Anna Srinivasan
June 23, 2005 08:38 AM UTC
Hi,
Thanks,This code works fine.
Same code i am using in my project but it is not working.(I have comment out all the other event present in that class)
Q1: Is there any other property i need to set, to get that action..?
Thanks, Anna
AD
Administrator
Syncfusion Team
June 23, 2005 09:30 AM UTC
Is the event not being hit? Or, is the event being hit and the code not working?
Are you using nested tables?
AS
Anna Srinivasan
June 23, 2005 10:00 AM UTC
Hi,
Yes, Event being hit.
I am not using nested tables.
Thanks, Anna
AD
Administrator
Syncfusion Team
June 23, 2005 11:33 AM UTC
Just something to try. From code, right before you call ResetWidth, explicitly set the size of the column to some value (so the grid thinks it can be ''reset'').
If that does not help, then if you can upload a sample showing the problem we can try to debug it here.