简体   繁体   中英

Embed HTML file in C# visual studio project and later open it using internet explorer

I want to embed HTML file as a help file in my C#.Net project in Visual Studio.

Later I want to open it by clicking on a LinkLabel.

Not quite sure, first how to add this file to my project resources, set the path and then open it.

It should be embedded along with the published installation file so that once user will install the application, they will be able to open this embedded file.

Loading your embedded page could be achieved with something along these lines from msdn :

try
{
   _assembly = Assembly.GetExecutingAssembly();
   _textStreamReader = new StreamReader(_assembly.GetManifestResourceStream("MYHTMLFile.html"));
}
catch
{
   MessageBox.Show("Error accessing resources!");
}

That page also details the steps for embedding.

In your case (I think) you would have to save down the stream to disk before loading with IE.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM