Save the MHT file as a temporary file, open it with the WebBrowser navigate method, and the code is as follows:
Reading a resource file from an assembly
Assembly asmm = assembly.getcallingassembly ();
Assembly asm = Assembly.reflectiononlyloadfrom (addinfo.htmlassembly);
Stream str=asm. GetManifestResourceStream (Addinfo.htmlnavigationfile);
if (str = = null)
return false;
Save As temp file
String Vfilepath=appdomain.currentdomain.basedirectory + "Temp";
String Vfilename =vfilepath + "\\index.mht";//MHT file inside my resource file
if (directory.exists (vfilepath) = = False)
Directory.CreateDirectory (Vfilepath);
if (file.exists (vfilename))
File.delete (Vfilename);
StreamReader sr = new StreamReader (str);
StreamWriter SW = new StreamWriter (vfilename);
Sw. Write (Sr. ReadToEnd ());
Sw. Flush ();
Sw. Close ();
Sr. Close ();
WebBrowser loading
Wbnavigation.navigate ("file://" +vfilename);
while (wbnavigation.readystate! = webbrowserreadystate.complete)
{
Application.doevents ();
}
WebBrowser showing MHT files in the