【问题标题】:Load local html file in webbrowser control in editable mode以可编辑模式在 webbrowser 控件中加载本地 html 文件
【发布时间】:2013-02-18 09:17:58
【问题描述】:

我想在 editable 模式下在 webbrowser 控件中加载本地 html 文件。我在 webBrowser 中加载 html 文件的代码是:

private void LoadFile(string filename)
{
    using (StreamReader reader = File.OpenText(filename))
    {
       webBrowser1.DocumentText = reader.ReadToEnd();
       reader.Close();
       Text = webBrowser1.DocumentTitle;
    }
}

但它不可编辑。

【问题讨论】:

  • 可编辑模式是什么意思?您想更改 webBrowser 控件中的 html 代码吗?
  • 是的,我想在浏览器中编辑 html 代码,我做到了。 :)

标签: c# .net winforms webbrowser-control


【解决方案1】:

请检查这个sn-p。

 webBrowser1.AllowWebBrowserDrop = false;
    webBrowser1.Url = new Uri(@"D:\TEMP\sample.htm");

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-27
    • 1970-01-01
    • 1970-01-01
    • 2012-07-18
    • 1970-01-01
    • 2011-08-12
    • 1970-01-01
    相关资源
    最近更新 更多