如何使用相对路径将本地* .htm文件加载到WPF WebBroswer [英] How to load local *.htm file to WPF WebBroswer with relative path

查看:133
本文介绍了如何使用相对路径将本地* .htm文件加载到WPF WebBroswer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:


Possible Duplicate:
Load local HTML file in a C# WebBrowser

I´m creating program in C# (VS 2010), and I´d like to show help file. I created file help.htm. This file is included to solution in help directory. And I´d like this htm file load to webBroswer in Dialog. But there is a probelm, when I try to use relative path.

            HelpWindow helpwin = new HelpWindow(); //creating new window

            Uri helpUri = new Uri ("help\\pm_view.htm",UriKind.RelativeOrAbsolute); //setting path

            helpwin.webBrowser.Navigate(helpUri); //navigating webBroswer

After that, i get error: Relative URIs are not allowed. Parameter name: source

There is my C# solution schema in picture:

Please can anyone help?!

Thanks a lot!

解决方案

Have you tried using

Path.GetFullPath(YourRelativePath)

as per this answer: Answer on relative paths in WPF?

这篇关于如何使用相对路径将本地* .htm文件加载到WPF WebBroswer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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