开发者

How to close Find window in a webbrowser control

I use a WebBrowser control and it's find functionality:

    private void findToolStripMenuItem_Click(object sender, EventArgs e)
    {
        webBrowser1.Select();
        SendKeys.Send("^f");
    }

Which works fine. Only problem that there is a case when user can make WebBrowser unvisible to per开发者_高级运维form some other tasks:

webBrowser1.Visible = false;

But Find window remains visible. Any suggestions? Thank you.


To close, try this

        webBrowser1.Select();
        SendKeys.Send("^f");
        SendKeys.Send("{ESCAPE}");

There is no easy/direct way to control the Find dialog. One way to close the Find dialog is by sending "ESCAPE" to the dialog when it has focus. If you send "^f" prior to sending "ESCAPE", that will force the find dialog to get focus.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜