Cefsharp网页搜索

Cefsharp webpage search


我想在我的页面中添加搜索功能,同时具有 search_next、search_previous、search_close(清除选择)功能 我想了解有关的信息search_result_count、current_search_result_index。但是CEF中只暴露了两个方法API:

public void Find(int identifier, string searchText, bool forward, bool matchCase, bool findNext);

public void StopFinding(bool clearSelection);

看来我们首先可以做 search_next 和 search_previous。 我尝试按照以下方式执行此操作并能够按预期向后和向前搜索但是当我尝试搜索其他词时它不起作用:

private void previousMouseUp(object sender, MouseButtonEventArgs e)
    {
        ChromeView.Find(searchIdentifier, searchText, false, isCaseSensitive, true);
    }
private void nextMouseUp(object sender, MouseButtonEventArgs e)
    {
        ChromeView.Find(searchIdentifier, searchText, true, isCaseSensitive, true);
    }

并且没有公开获取搜索结果计数和当前搜索索引的方法。我使用的是 41.0.1.0 版本。请指导我正确的方向来达到我的要求? 请不要介意我的英文;

CefSharp.WinForms.Example 具有 Find 的基本工作实现。

https://github.com/cefsharp/CefSharp/blob/cefsharp/43/CefSharp.WinForms.Example/BrowserTabUserControl.cs#L253

CEF API 文档是 http://magpcss.org/ceforum/apidocs3/projects/%28default%29/CefBrowserHost.html#Find%28int,constCefString&,bool,bool,bool%29