DTE2.UndoContext 屬性
取得全域 UndoContext 物件。
命名空間: EnvDTE80
組件: EnvDTE80 (在 EnvDTE80.dll 中)
語法
'宣告
ReadOnly Property UndoContext As UndoContext
UndoContext UndoContext { get; }
property UndoContext^ UndoContext {
UndoContext^ get ();
}
abstract UndoContext : UndoContext with get
function get UndoContext () : UndoContext
屬性值
類型:UndoContext
UndoContext 物件。
範例
Sub UndoContextExample()
Dim selection As TextSelection = DTE2.ActiveDocument.Selection()
Dim start As EditPoint = selection.TopPoint.CreateEditPoint()
Dim endpt As TextPoint = selection.BottomPoint
Dim commentStart As String
DTE2.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.
DTE2.UndoContext.Close()
End Try
End Sub
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。