UndoContext.Close أسلوب
Ends an مرحلة التراجع تشغيل.
مساحة الاسم: EnvDTE
التجميع: EnvDTE (في EnvDTE.dll)
بناء الجملة
'إقرار
Sub Close
void Close()
void Close()
abstract Close : unit -> unit
function Close()
ملاحظات
If there are معلّقة مراجع إلى the UndoContext كائن, then Close aborts the تشغيل و raises an خطأ. An خطأ occurs if the UndoContext كائن ليس فتح when Close هو called.
أمثلة
Sub RemoveNewLines()
' Before running, select text in an open document.
Dim txtSel As TextSelection
Dim strTS As String, boolWasOpen As Boolean
txtSel = DTE.ActiveDocument.Selection
strTS = txtSel.Text
' Check to see if UndoContext object is already open.
If DTE.UndoContext.IsOpen = True Then
boolWasOpen = True
Else
' Open the UndoContext object to track changes.
DTE.UndoContext.Open("RemoveNewLines", False)
End If
' Perform search for newline characters and remove them.
If strTS <> "" Then
txtSel.Delete()
strTS = Replace(strTS, vbNewLine, "", Compare:=vbTextCompare)
txtSel.Insert(strTS)
End If
' If UndoContext was already open, don't close it.
If boolWasOpen = False Then
' Close the UndoContext object to commit the changes.
DTE.UndoContext.Close()
End If
End Sub
أمن NET Framework.
- الثقة الكاملة للمتصل الفوري. يتعذر استخدام هذا العضو بواسطة التعليمات البرمجية الموثوق بها جزئيًا. لمزيد من المعلومات، راجع باستخدام مكتبات من تعليمات برمجية موثوق بها جزئي.