|
//this event gets triggered when the row height is changed.
void TableModel_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
if (e.Index > 0)
{
IGraphicsProvider graphicsProvider = this.gridGroupingControl1.TableModel.GetGraphicsProvider();
Graphics g = graphicsProvider.Graphics;
GridStyleInfo style = this.gridGroupingControl1.TableModel[e.Index, 2];
GridCellModelBase model = style.CellModel;
e.Size = model.CalculatePreferredCellSize(g, e.Index, 2, style, GridQueryBounds.Height).Height;
e.Handled = true;
}
//To avoid the painting issue
this.gridGroupingControl1.TableControl.InvalidateRange(GridRangeInfo.Table());
} |
|
//To enable the individual height for rows
GridEngineFactory.Factory = new AllowResizingIndividualRows();
InitializeComponent();
//data binding
this.gridGroupingControl1.DataSource = ReturnATable();
//the size set evenly according to the content of cells.
this.gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table());
//Event triggering
this.gridGroupingControl1.TableControlCurrentCellEditingComplete += GridGroupingControl1_TableControlCurrentCellEditingComplete;
//Event customization
private void GridGroupingControl1_TableControlCurrentCellEditingComplete(object sender, GridTableControlEventArgs e)
{
//T resize the height after the cell value is updated.
this.gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table());
} |
|
//the size set evenly according to the content of cells.
this.gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table());
//Event triggering
this.gridGroupingControl1.TableModel.RowHeightsChanging += newGridRowColSizeChangingEventHandler(TableModel_RowHeightsChanging);
//Event handling
void TableModel_RowHeightsChanging(object sender,GridRowColSizeChangingEventArgs e)
{
//Provide us the stack trace/Call stack.
} |