Posted 21 February 2024, 1:27 am EST
Hello Kingman,
Apologies for misunderstanding the issue.
As there is no such event “UndoCompleting” available in the API, you can use the PreviewKeyDown and Sheet’s RowChanged events in order to capture action before undoing.
Please see the following code and let us know if it helps:
fpSpread1.PreviewKeyDown += FpSpread1_PreviewKeyDown;
fpSpread1.RowDragMoveCompleted += FpSpread1_RowDragMoveCompleted;
fpSpread1.Sheets[0].RowChanged += Form1_RowChanged;
bool undoRowDrag = false;
private void FpSpread1_RowDragMoveCompleted(object sender, FarPoint.Win.Spread.DragMoveCompletedEventArgs e)
{
worksheet.wsDataModel.resumeUpdate();
}
private void Form1_RowChanged(object sender, FarPoint.Win.Spread.SheetViewEventArgs e)
{
if (undoRowDrag)
{
worksheet.wsDataModel.suspendUpdate();
undoRowDrag = false;
}
}
private void FpSpread1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if(e.Control && e.KeyCode == Keys.Z)
{
undoRowDrag = true;
}
}
Please let us know if it helps.
Regards,
Prabhat Sharma.