method Chart.StartBlockUndoRedo ()
Starts recording the UI operations as a block of undo/redo operations.

TypeDescription
The StartBlockUndoRedo method starts recording the UI operations as a block on undo/redo operations. The method has effect only if the AllowUndoRedo property is True. The EndBlockUndoRedo method collects all undo/redo operations since StartBlockUndoRedo method was called and add them to the undo/redo queue as a block. This way the next call on a Undo operation, the entire block is restored, so all UI operations are restored. For instance, if you have a procedure that moves several bars, and want all of them being grouped, you can use StartBlockUndoRedo to start recording the operations as a block, and call the EndBlockUndoRedo when procedure ends, so next call of an undo operation the bars are restored to their original position. The EndBlockUndoRedo method must be called the same number of times as the StartBlockUndoRedo method was called. For instance, if you have called the StartBlockUndoRedo twice the EndBlockUndoRedo method must be called twice too, and the collected operations are added to the chart's queue of undo/redo operations at the end.

The chart fires the ChartStartChanging event when the user starts an UI operation, for instance, moving a bar. The ChartEndChanging event notifies your application once the user operation on the chart ends. By default, each undo/redo operation is added sequentially as they occur. You can call the StartBlockUndoRedo method during the ChartStartChanging event so all operations that are about to begin will be as a block when calling the EndBlockUndoRedo during the ChartEndChanging event. For instance, if a bar is related to multiple bars using grouping options, so if a bar is moved other bars must be moved, the undo/redo operations are added sequentially as they appear. So calling the Undo action will restore moving a bar once at the time. Using the StartBlockUndoRedo/EndBlockUndoRedo methods you can control the block of undo/redo operations being grouped in a block, so next time the Undo/Redo operation is performed, the entire block of operations is performed or restored at once. For instance, the SchedulePDM method performs multiple operations during bars, so all of them are grouped as a block.

For instance, we we have the following chart:

In this case the, the K1, K2 and K3 bars are grouped, so moving any bar will result in moving relative bars. 

The  following screen shot shows the chart after moving the bar K3 to a new position as well as a to a new parent, 

so the undo/redo queue looks like:

StartBlock
MoveBar;1;sum
MoveBar;2;K4
MoveBar;3;K3
EndBlock
ParentChangeBar;2;K3

In this case, we need to press twice the CTRL + Z to restore back the chart as it was before moving the bar K3.

Instead if we are using the StartBlockUndoRedo and EndBlockUndoRedo methods as follow:

Private Sub G2antt1_ChartStartChanging(ByVal Operation As EXG2ANTTLibCtl.BarOperationEnum)
    G2antt1.Chart.StartBlockUndoRedo
End Sub

Private Sub G2antt1_ChartEndChanging(ByVal Operation As EXG2ANTTLibCtl.BarOperationEnum)
    G2antt1.Chart.EndBlockUndoRedo
End Sub

We have the undo/redo queue as follows ( if we perform the same operation ):

StartBlock
MoveBar;1;sum
MoveBar;2;K4
MoveBar;3;K3
ParentChangeBar;2;K3
EndBlock

In this case, we need to press only once the CTRL + Z to restore back the chart as it was before moving the bar K3.