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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Removing Cells (or the appearance of it)

Thread ID:





647 Jul 18,2002 07:20 PM UTC Jul 18,2002 08:52 PM UTC WinForms 1
Tags: GridControl
Roy Muller
Asked On July 18, 2002 07:20 PM UTC

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]; grid.ClearCells(GridRangeInfo.Cell(1,4),TrueOrFalseWhateverWorks); 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.

Stefan Hoenig [Syncfusion]
Replied On July 18, 2002 08:52 PM UTC

Hi Roy, 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); this.gridControl1.BeginUpdate(); this.gridControl1.SetCells(target, cells); this.gridControl1.ClearCells(clear, true); this.gridControl1.EndUpdate(false); this.gridControl1.Refresh(); } } I attached a sample project. Stefan Hoenig


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon