_DTE.UndoContext 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取全局 UndoContext 对象。
public:
property EnvDTE::UndoContext ^ UndoContext { EnvDTE::UndoContext ^ get(); };
public:
property EnvDTE::UndoContext ^ UndoContext { EnvDTE::UndoContext ^ get(); };
[System.Runtime.InteropServices.DispId(235)]
public EnvDTE.UndoContext UndoContext { [System.Runtime.InteropServices.DispId(235)] get; }
[<System.Runtime.InteropServices.DispId(235)>]
[<get: System.Runtime.InteropServices.DispId(235)>]
member this.UndoContext : EnvDTE.UndoContext
Public ReadOnly Property UndoContext As UndoContext
属性值
UndoContext 对象。
- 属性
示例
Sub UndoContextExample()
Dim selection As TextSelection = DTE.ActiveDocument.Selection()
Dim start As EditPoint = selection.TopPoint.CreateEditPoint()
Dim endpt As TextPoint = selection.BottomPoint
Dim commentStart As String
DTE.UndoContext.Open("Comment Region")
Try
Do While (start.LessThan(endpt))
start.Insert(commentStart)
start.LineDown()
start.StartOfLine()
Loop
Finally
' If an error occured, then need to make sure that the undo
' context is cleaned up. Otherwise, the editor can be left in a
' perpetual undo context.
DTE.UndoContext.Close()
End Try
End Sub