MS WebBrowser + Embedded HTML Resource + res:// Protocol

前端 未结 7 1074
野趣味
野趣味 2020-12-17 21:34

I have an embedded HTML resource (helloworld.htm) inside my Visual Studio project. (Ie, I\'ve added an HTML file to the project and set its properties to \"Embedded Resource

7条回答
  •  猫巷女王i
    2020-12-17 21:56

    I know this thread is dead, but I had to do this yesterday and couldn't get any of these methods to work. So I did a little research and found the method below, using the Stream class. I thought I'd post it here just in case somebody else runs into the same nonsense:

    Stream docStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NameSpace.HTMLPage.html");
    WebBrowser.DocumentStream = docStream;
    

    This worked for me without any tinkering, and it was so simple. I hope it benefits somebody else!

提交回复
热议问题