共用方式為


IVsUndoUnit Interface

Determines if the undo unit applies to UI items only.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)

Syntax

'宣告
<GuidAttribute("A8C3D107-7EDF-4B1B-8A81-080AC91590E9")> _
<InterfaceTypeAttribute()> _
Public Interface IVsUndoUnit
'用途
Dim instance As IVsUndoUnit
[GuidAttribute("A8C3D107-7EDF-4B1B-8A81-080AC91590E9")]
[InterfaceTypeAttribute()]
public interface IVsUndoUnit
[GuidAttribute(L"A8C3D107-7EDF-4B1B-8A81-080AC91590E9")]
[InterfaceTypeAttribute()]
public interface class IVsUndoUnit
[<GuidAttribute("A8C3D107-7EDF-4B1B-8A81-080AC91590E9")>]
[<InterfaceTypeAttribute()>]
type IVsUndoUnit =  interface end
public interface IVsUndoUnit

Remarks

Interface exposed by IOleUndoUnit or IOleParentUndoUnit if UI-only undo items (like text selection and/or caret movements) are going to be put on the undo stack. The UI only undo units do not reset the redo stack. Normally, when a new undo unit is added to the undo stack, the redo stack is cleared. However, if the undo unit is not a data changing undo, then you can use IOleUndoUnit to make sure the redo stack does not get cleared. This allows undo units that change the UI only (cursor movements, for example) to not to interfere with the users ability to perform a redo.

The environment's implementation of IOleUndoManager looks for IOleUndoUnit and if it finds it, it calls fChangeData method to determine whether this is a UI-only undo unit fChangeData returns false). This interface can also be implemented in linked undo transaction to make the linked undo siblings ignore UI only undo actions in a linked document. For more information on linked undo transactions, see How to: Implement Linked Undo Management.

Notes to Implementers

Implement this interface if you have UI only undo items that go on the undo stack and you need to make sure the redo stack does not get reset. Implement this interface also if you have a linked undo transaction situation, where you want the siblings to ignore undo actions that involve UI only in another linked sibling.

See Also

Reference

IVsUndoUnit Members

Microsoft.VisualStudio.TextManager.Interop Namespace