What Does GridControl.ClearCells( GridRangeInfo, bool) do? What does the 'bool' arg specify? The docs are not clear on this.
I have a grid that starts out with 4 rows, 10 cols and the default cell type (TextBox?). I populate the grid by changing the CellType to PushButton and setting the Description field. When the user presses a cell I want to give the appearance of the cell contents being removed and the other cells shifting over to replace what was there. There does not seem to be an easy way to do this. I was hoping to be able to do the following:
Assume a 1 Row x 4 Col grid.
User selects 1,3.
grid[1,3] = grid[1,4];
There must be a better way... does the cell assignment statement in the above pseudocode 'do the right thing'?
The Grid.PopulateValues() was enticing, but each value from my array occupied a row instead of a cell, so I've resorted to using iteration.
SHStefan Hoenig Syncfusion Team July 18, 2002 03:52 PM
the Boolean flag indicates if only text content shall be cleared out or if all cell content information including color, cell type and other appearance information should be cleared. ClearCells does not shift cells. I agree that is something we should add (something like a MoveCells method) and we'll look into that.
What you can do now is use a combination of GetCells, SetCells and Clear to shift cells:
private void button1_Click(object sender, System.EventArgs e)
int top = 3;
int bottom = 10;
int colCount = this.gridControl1.ColCount;
GridRangeInfo source = GridRangeInfo.Cells(top,4,bottom,colCount);
GridRangeInfo target = GridRangeInfo.Cells(top,2,bottom,2+source.Width-1);
GridRangeInfo clear = GridRangeInfo.Cells(top,target.Right+1,bottom,colCount);
GridStyleInfoStoreTable cells = this.gridControl1.GetCells(source);
I attached a sample project.