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.

GridGroupingControl RowHeight and AutoSize

Thread ID:

Created:

Updated:

Platform:

Replies:

68898 Oct 4,2007 02:53 PM Oct 5,2007 01:39 PM Windows Forms 5
loading
Tags: GridControl
Michael Sabin
Asked On October 4, 2007 02:53 PM

I am using a gridGroupingGrid that uses a Custom Engine in which The GridRecordRow is overriden to implement the IGridRowHeight interface (i.e. we want to be able to manually set the row heights for rows in a record).

I use it in the following manner: The grid is composed of records that span two rows. There are cases where I set the second row in the record to a height of 0. But the first row is always set to the default row height.

However, there are cases where the text in the cells takes up more space than the width of the cell. Is there some mechanism that I can use to resize that the first row in the record, so it is large enough to fit the contents? However, I would like to maintain the ability to set row to a height of 0 for the second row.

haneefm [Syncfusion]
Replied On October 4, 2007 03:45 PM

Hi Michael,

Please try this code and let me know if this helps.

gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Row(RowIndexOfFirstRowIntheRecord), GridResizeToFitOptions.ResizeCoveredCells);

Best regards,
Haneef

Michael Sabin
Replied On October 4, 2007 05:04 PM

Ok, thanks for the help. However, I am having a problem relating to rules in collapsed groups. Here is the code I am using:

int numRows = this.gridGroupingControl1.TableControl.Model.RowCount;
for (int i = 0; i < numRows; i++)
{
GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.Model[i, 2];
if (style.CellType.Equals("CheckBox"))
gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Row(i), GridResizeToFitOptions.ResizeCoveredCells);
}

I can tell if the row is the first row in a record if the CellType is a ComboBox. However, this code will skip all of the rows that are in a collapsed group. Is there a way to run the ResizeToFit on all records?

Thanks

haneefm [Syncfusion]
Replied On October 4, 2007 05:27 PM

Hi Michael,

Is there a way to run the ResizeToFit on all records?
>>>>>>>>>
You can try this code:

gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.ResizeCoveredCells);

and let me know if this helps.

Best regards,
Haneef

Michael Sabin
Replied On October 5, 2007 08:40 AM

Thanks, but this will prevent me from keeping the second row in the record to a height of 0. Is there any other workarounds?


>Hi Michael,

Is there a way to run the ResizeToFit on all records?
>>>>>>>>>
You can try this code:

gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.ResizeCoveredCells);

and let me know if this helps.

Best regards,
Haneef

Michael Sabin
Replied On October 5, 2007 01:39 PM

OK, i think i figured a way around this:

before running the resize to fit code, call grid.Table.ExpandAllGroups(). Then after the resize, call grid.Table.CollapseAllGroups()

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.

;