如何加载从流/字符串MHT到WebBrowser控件? [英] How to load mht from stream/string into a WebBrowser control?

查看:147
本文介绍了如何加载从流/字符串MHT到WebBrowser控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WebBrowser控件正确加载任何 MHT 文件,如果我使用导航的方法,但是当我使用 DocumentText DocumentStream 属性的 MHT 源 code>显示文件,如果我打开记事本文件中。

The WebBrowser control loads properly any mht file if I use the Navigate method, but when I use the DocumentText or DocumentStream properties, the source of the mht file is displayed as if I opened the file in notepad.

如果我写的流到一个临时文件,然后导航到它,它工作正常,但我不想做这种方式。

If I write the stream to a temp file then Navigate to it, it works properly, but I don't want to do it this way.

此问题似乎常见的,但我并没有为它找到一个可行的解决方案。 <一href="http://stackoverflow.com/questions/2570592/how-to-set-content-type-of-a-webbrowser-control">Some人们建议我应该欺骗IE浏览器通过实施 IPersistMoniker COM接口,...等等。我曾试图与这一点,但不幸的是我得到了相同的结果。可能是我做错了什么。我还是觉得自己应该是​​一个比较简单的解决方案(而不是保存在一个临时文件第一),任何想法?

This issue seems common, but I didn't find a working solution for it. Some people suggest I should fool IE by implementing IPersistMoniker com interface, ...etc. I have tried with this a little bit, but unfortunately I got the same result. May be I have done something wrong. I still feel their should be a more straightforward solution (other than saving in a temp file first), any idea?

推荐答案

我记得我在几年前面临同样的问题,虽然我搜索了一个解决方案,那我也没有找到。最后,我去临时文件的方法。祝你好运,如果有一个答案,我想知道太多。

I remember I was facing the same issue a few years ago and although I searched for a solution then I did not find any. In the end, I went for the temp-file approach. I wish you good luck, and if there's an answer I would like to know too.

这篇关于如何加载从流/字符串MHT到WebBrowser控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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