如何Ctrl +在Web浏览器中输入工作 [英] How to Ctrl + Enter work in a webbrowser
本文介绍了如何Ctrl +在Web浏览器中输入工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个Web浏览器.如果我们在URL中单击Ctrl + Enter,它将显示www.xxxxx.com,但Ctrl + Enter无法正常工作.那一个背后的代码是什么.任何请帮助我.我正在使用此代码,这不起作用
I am creating a web Browser. If we click Ctrl+Enter in URL it shows www.xxxxx.com but Ctrl+Enter is not working. What is the code behind that one. Any please help me. I am using this code this is not working
private void txtURL_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
GoTo(txtURL.Text);
}
}
private void GoTo(String strUrl)
{
if (String.IsNullOrEmpty(strUrl)) return;
if (strUrl.Equals("about:blank")) return;
if (!strUrl.StartsWith("http://"))
strUrl = "http://" + strUrl;
try
{
// Loads the document into the WebBrowser Control
webBrowser1.Navigate(new Uri(strUrl));
}
catch (System.UriFormatException)
{
return;
}
}
推荐答案
如何操作:
How about this:
if (e.KeyData == (Keys.ControlKey | Keys.Enter))
祝你好运!
Good luck!
您还可以使用:
You could also use:
if (e.KeyCode == Keys.Enter && Control.ModifierKeys == Keys.Control )
这篇关于如何Ctrl +在Web浏览器中输入工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文