Article | 60000282 |
Type | HowTo |
Product | Engine |
Version | 6 |
Date Added | 10/24/2007 12:00:00 AM |
Fixed | (10/24/2007 12:00:00 AM) |
Submitted by | PDHelly |
Summary
How can I zoom/pan without adding these actions to Undo/Redo list using the .NET components.
Solution
You can use the onUndoStoreValue of the vdDocument event and when the ViewSize or ViewCenter changes (this happens with zoom and/or pan) then set the Cancel to true. Like :
private void Form1_Load(object sender, EventArgs e)
{
vdFramedControl1.BaseControl.ActiveDocument.OnUndoStoreValue += new VectorDraw.Professional.vdObjects.vdDocument.UndoStoreValueEventHandler(ActiveDocument_OnUndoStoreValue);
}
void ActiveDocument_OnUndoStoreValue(object sender, bool isRedo, object propObject, string propName, object value, ref bool Cancel)
{
if (propName.ToLower() == "viewcenter" || propName.ToLower() == "viewsize")
{ // zoom pan change ViewCenter and ViewSize
Cancel = true; // This will not write to the UNDO the pan/zoom actions
}
}
For version 7 the code should be:
void ActiveDocument_OnUndoStoreValue(object sender, bool isRedo, object propObject, string propName, object value, ref bool Cancel) { if (propName.ToLower() == "viewcenter" || propName.ToLower() == "viewsize" || propObject.ToString().ToLower() == "zoom") { // zoom & pan change ViewCenter and ViewSize Cancel = true; // This will not write to the UNDO the pan/zoom actions } }