将WebBrowser控件设置为设计模式问题... [英] setting WebBrowser Control to Design Mode Problems...

查看:121
本文介绍了将WebBrowser控件设置为设计模式问题...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Iam使用Visual Basic 2010专业版

将Web浏览器(IE 9)控件设置为编辑模式时,无法更改其html源代码.例如,当我将此代码添加到button_click事件中时:

WebBrowser1.DocumentText ="Hellooo"所有文档文本变为空(删除DocumentText中的所有内容)

所以我的意思是我想以编辑模式打开现有的HTML文件,并使用设计模式和代码文本进行编辑.

我用来将webBrowser设置为设计"模式的代码是:

Me.WebBrowser1.Document.ExecCommand("EditMode",False,什么都没有)

另一个问题,例如当我想将链接添加到选定的文本时,我使用了以下代码:

Me.WebBrowser1.Document.ExecCommand("CreateLink",False,Nothing)

此代码的问题是webBrowser控件的链接对话框,我想显示我的自定义对话框...不仅用于插入链接,还用于插入图像和其他对话框...

最好的问候,

AlSayed

Hi Iam using Visual Basic 2010 Proffisional

When I set the webbrowser (IE 9) control to editing mode, I can''t change the html source code of it. for example when I add this code into button_click event :

WebBrowser1.DocumentText = "Hellooo" All document Text become nothing (Delets all things in DocumentText)

so I mean I want to open existing HTML file in editing mode, and edit it with design mode and code text too.

the code I used to set the webBrowser into Designing mode is:

Me.WebBrowser1.Document.ExecCommand("EditMode", False, Nothing)

another problem for example when I want to add link to selected text I used this code:

Me.WebBrowser1.Document.ExecCommand("CreateLink", False, Nothing)

The problem of this code is the webBrowser control its link dialog, and I want to display my custom dialog... not for insert link only, but for insert image and other dialogs...

Best Regards,

AlSayed

推荐答案

首先,IE(或WebBrowser控件)不支持EditMode.
至于显示自定义对话框,您将必须创建该对话框并自己显示以要求插入URL.执行CreateLink与显示对话框无关.

DefaultUserInterface参数只是告诉浏览器要么显示用于创建链接的默认对话框,要么不显示任何对话框.您不会告诉它显示对话框.
First, EditMode is not supported by IE (or the WebBrowser control).

As for displaying a custom dialog, you''ll have to create the dialog and show it yourself to ask for the URL to insert. Executing CreateLink has nothing to do with showing the dialog.

The DefaultUserInterface parameter just tells the browser to either show the default dialog for creating the link or to show NO dialog at all. You don''t get to tell it to show your dialog.


这篇关于将WebBrowser控件设置为设计模式问题...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆