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
close icon

Can cut work like Excel?

In Excel, the source text disappear until user paste it. In Syncfusion, the source text disappear immediately when the cut it. How can we make Syncfusion''s Cut working like Excel? Thanks.

1 Reply

AD Administrator Syncfusion Team March 18, 2004 11:00 AM UTC

This will only work if you cut and paste into the same grid (but I think excel has the same behavior). You can catch the grid''s ClipboardCut event, and copy the selections to the clipboard, save the ranges, and then set e.handled so the grid does not try to do its own cutting later. Then you can catch the grid.Model''s ClipboardPasted event, and there clear the saved ranges. //subscribe to the events this.grid.Model.ClipboardPasted += new GridCutPasteEventHandler(grid_ClipboardPasted); this.grid.ClipboardCut += new GridCutPasteEventHandler(grid_ClipboardCut);
private GridRangeInfoList cutRangeList = null;
private void grid_ClipboardCut(object sender, Syncfusion.Windows.Forms.Grid.GridCutPasteEventArgs e)
{
	GridRangeInfoList rangeList = this.grid.Selections.Ranges.Clone();
	if(this.grid.CutPaste.CopyTextToClipboard(rangeList))
	{
		cutRangeList = rangeList.Clone();
		e.Handled = true;
		e.Result = true;
	}
}
private void grid_ClipboardPasted(object sender, Syncfusion.Windows.Forms.Grid.GridCutPasteEventArgs e)
{
	if(cutRangeList != null && cutRangeList.Count > 0)
	{
		this.grid.ClearCells(cutRangeList, false);
	}
	cutRangeList = null;
}

Loader.
Live Chat Icon For mobile
Up arrow icon