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