Web浏览器控件在Windows 7中不起作用 [英] Web Browser control is not working in Windows 7
本文介绍了Web浏览器控件在Windows 7中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我使用的是Visual Studio 2008 framework 3.0,
我在Windows窗体中创建了一个带有Web浏览器控件的编辑器添加html标签并保存到数据库....并且我能够在Windows XP中编辑文本并在Web浏览器控件中输入文本,在Windows 7中我无法输入单个字母..请帮我解决这个问题...
Hi
I m using Visual Studio 2008 framework 3.0,
I have created a editor in windows form with web browser control and adding html tags to it and saving to database.... and i m able edit text and enter text in web browser control in Windows XP, In windows 7 i m unable to enter single letter into it.. please help me to over come this problem...
推荐答案
我有解决方案
基于Windows窗体的HTML输出文本编辑器 [ ^ ]
需要在editor.cs中添加代码,你可以在上面链接的评论中找到代码。
private void theBrowser_DocumentCompleted(对象发送者,WebBrowse rDocumentCompletedEventArgs e)
{
//现有代码....
HTMLDocument HTMLDocument =
(HTMLDocument)doc;
((HTMLDocumentEvents2_Event)HTMLDocument).onkeypress + = new
HTMLDocumentEvents2_onkeypressEventHandler(this。 On_KeyPressEvent);
}
private bool On_KeyPressEvent(mshtml.IHTMLEventObj e)
{
if(e.ctrlKey&&
(e.keyCode == 86 ||) e.keyCode == 118))
{
MessageBox.Show(粘贴);
}
返回true;
}
i have got the solution
A Windows Forms based text editor with HTML output[^]
Need to add code in the editor.cs and you can find code in the comments in the above link.
private void theBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
// Existing Code here....
HTMLDocument HTMLDocument =
(HTMLDocument)doc;
((HTMLDocumentEvents2_Event)HTMLDocument).onkeypress += new
HTMLDocumentEvents2_onkeypressEventHandler(this.On_KeyPressEvent);
}
private bool On_KeyPressEvent(mshtml.IHTMLEventObj e)
{
if (e.ctrlKey &&
(e.keyCode == 86 || e.keyCode == 118))
{
MessageBox.Show("Pasted");
}
return true;
}
''尝试添加此编码
''这是由于某些控制冲突造成的Internet Explorer和Windows操作系统
Private Sub webBrowser1_DocumentCompleted1(ByVal sender As Object,ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)处理webBrowser1.DocumentCompleted
如果webBrowser1.Version.Major> = 9那么
webBrowser1.Document.Write(webBrowser1.DocumentText)
doc .designMode =On
结束如果
结束Sub
''用于C#.NET
-----------
private void webBrowser1_DocumentCompleted(object sender,WebBrowserDocumentCompletedEventArgs e)
{
if(webBrowser1.V ersion.Major> = 9)
{
webBrowser1.Document.Write(webBrowser1.DocumentText);
doc.designMode =On ;
}
}
''Try this coding to be added
''This is due to some control conflict between the internet explorer and Windows OS
Private Sub webBrowser1_DocumentCompleted1(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles webBrowser1.DocumentCompleted
If webBrowser1.Version.Major >= 9 Then
webBrowser1.Document.Write(webBrowser1.DocumentText)
doc.designMode = "On"
End If
End Sub
''for C#.NET
-----------
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (webBrowser1.Version.Major >= 9)
{
webBrowser1.Document.Write(webBrowser1.DocumentText);
doc.designMode = "On";
}
}
这篇关于Web浏览器控件在Windows 7中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文