_DTE.UndoContext 属性
获取全局 UndoContext 对象。
命名空间: EnvDTE
程序集: EnvDTE(在 EnvDTE.dll 中)
语法
声明
ReadOnly Property UndoContext As UndoContext
UndoContext UndoContext { get; }
property UndoContext^ UndoContext {
UndoContext^ get ();
}
abstract UndoContext : UndoContext with get
function get UndoContext () : UndoContext
属性值
类型:EnvDTE.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
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。