开发者

How to close Find window in a webbrowser control

开发者 https://www.devze.com 2023-03-14 11:54 出处:网络
I use a WebBrowser control and it\'s find functionality: private void findToolStripMenuItem_Click(object sender, EventArgs e)

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

精彩评论

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