开发者

How to open a Html as a Help file in c#?

I have created a help in Html to attach to my project. My project has been developed in WPF.

But may I add the Html as a resource to the project or I just put the folder with my Html and the images I am using in it in the Project folder?

If t开发者_开发百科he second option is better than the first, how can I get the Path to my Html file?

Anyway I will create an installer to my App, I will use the installer from Visual Studio but when I do it, how I can make sure that he will open the Html successfully?


I would go with the second option and just have the file in the project (make sure to right-click->properties and turn on "copy to ouput directory").

You can use the WebBrowser control to render the html.

AppDomain.CurrentDomain.BaseDirectory gets you the directory containing the application.

XAML:

<WebBrowser Name="webBrowser1"/>

Code Behind:

var filename = "help.html";
var path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filename);      
webBrowser1.Navigate(path);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜