TextPane2.IncrementalSearch 属性
提供对文本编辑器的渐进式搜索 (ISearch) 功能的访问。
命名空间: EnvDTE80
程序集: EnvDTE80(在 EnvDTE80.dll 中)
语法
声明
ReadOnly Property IncrementalSearch As IncrementalSearch
Get
IncrementalSearch IncrementalSearch { get; }
property IncrementalSearch^ IncrementalSearch {
IncrementalSearch^ get ();
}
abstract IncrementalSearch : IncrementalSearch
function get IncrementalSearch () : IncrementalSearch
属性值
类型:EnvDTE80.IncrementalSearch
IncrementalSearch 对象。
示例
此示例打开一个文本文档,创建一个 IncrementalSearch 对象,然后在文本窗格中显示的文本中搜索字符“t”。 有关如何作为外接程序运行此示例的更多信息,请参见 如何:编译和运行自动化对象模型代码示例。
Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
ByRef custom As Array) Implements IDTExtensibility2.OnConnection
_applicationObject = CType(application, DTE2)
_addInInstance = CType(addInInst, AddIn)
TextPane2IncrementalSearchExample(_applicationObject)
End Sub
Sub TextPane2IncrementalSearchExample(ByVal dte As DTE2)
Dim objTW As TextWindow
Dim objPane As TextPane2
Dim objTextDoc As TextDocument
Dim objTextPt As TextPoint
Dim objEP As EditPoint
Dim incSearch As IncrementalSearch
' Create a new text document.
_applicationObject.ItemOperations.NewFile("General\Text File")
' Get a handle to the new document and create EditPoint,
' TextPoint, and TextPane objects.
objTextDoc = CType(_applicationObject.ActiveDocument.Object _
("TextDocument"), TextDocument)
objEP = objTextDoc.StartPoint.CreateEditPoint
objTextPt = objTextDoc.StartPoint
' Plug in some text.
objEP.Insert("A test sentence.")
objTW = CType(dte.ActiveWindow.Object, TextWindow)
objPane = CType(objTW.ActivePane, TextPane2)
' Create an incremental search object.
incSearch = objPane.IncrementalSearch
incSearch.StartForward()
MsgBox("Searching for a 't'.")
incSearch.AppendCharAndSearch(Asc("t"))
incSearch.Exit()
End Sub
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。