Share via


IncrementalSearch 接口

提供对文本编辑器的渐进式搜索 (ISearch) 功能的访问。

命名空间:  EnvDTE80
程序集:  EnvDTE80(在 EnvDTE80.dll 中)

语法

声明
<GuidAttribute("C5BEE6D8-ED45-4317-96BF-97EB88EA3A07")> _
Public Interface IncrementalSearch
[GuidAttribute("C5BEE6D8-ED45-4317-96BF-97EB88EA3A07")]
public interface IncrementalSearch
[GuidAttribute(L"C5BEE6D8-ED45-4317-96BF-97EB88EA3A07")]
public interface class IncrementalSearch
[<GuidAttribute("C5BEE6D8-ED45-4317-96BF-97EB88EA3A07")>]
type IncrementalSearch =  interface end
public interface IncrementalSearch

IncrementalSearch 类型公开以下成员。

属性

  名称 说明
公共属性 DTE 获取顶级扩展性对象。
公共属性 IncrementalSearchModeOn 获取一个值,该值指示是否正在执行 ISearch。
公共属性 Pattern 获取正在当前的 ISearch 中处理的字符。

页首

方法

  名称 说明
公共方法 AppendCharAndSearch 向 ISearch 模式添加一个字符并针对新字符串执行搜索。
公共方法 DeleteCharAndBackup 从搜索模式中移除一个字符,并将选定内容移回到上一个匹配项。
公共方法 Exit 停止当前的 ISearch 并将编辑器返回到其基本行为。
公共方法 SearchBackward 从当前位置到文档的开头搜索当前模式。
公共方法 SearchForward 从当前位置到文档的结尾搜索当前模式。
公共方法 SearchWithLastPattern 在不更改模式的情况下重复当前的 ISearch
公共方法 StartBackward 开始向后搜索。
公共方法 StartForward 开始向前搜索。

页首

示例

Sub testIS()
    ' Set variables for text pane.
    Dim tp As EnvDTE80.TextPane2
    tp = CType(DTE.ActiveDocument.ActiveWindow.Object.ActivePane, _
    TextPane2)
    ' Start an incremental search forward from
    ' the current insertion point in the document.
    tp.IncrementalSearch.StartForward()
    ' Add the character "a" to the search pattern.
    tp.IncrementalSearch.AppendCharAndSearch(Asc("a"))
    ' Perform incremental search using the pattern ("a").
    tp.IncrementalSearch.SearchWithLastPattern()
    ' After the search, exit incremental search mode.
    tp.IncrementalSearch.Exit()
End Sub

请参阅

参考

EnvDTE80 命名空间

其他资源

How to: Search for Text Incrementally

How to: Search a Document Incrementally