卡住:VB WinForm将本地文件加载到WebView中

时间:2019-01-09 00:20:47

标签: vb.net winforms webview

我在VB的本地计算机上有一个WinForm

我有一个WebBrowser控件。

我有一个WebView控件。

我可以使用Form1.WebBrowser1.Navigate(App.Path & "/ip.html")

将本地文件加载到WebBroswer中。

我可以使用以下方式将URL加载到WebView中:

MainForm.WebView1.NavigateToString= New Uri(String.Format("http://www.website.com/myPage.html"))

我可以使用以下命令将html作为字符串加载到WebView中:

MainForm.WebView1.Source = New Uri(String.Format("<html><h1>My Text Goes Here</h1></html>"))

如何将本地html文件加载到WebView中?

这些无效:

    Form1.WebView1.Navigate(App.Path & "/ip.html")
    Form1.WebView1.Navigate("file:///" & App.Path & "/MyPage.html")
    Form1.WebView1.Source(App.Path & "/MyPage.html")
    Form1.WebView1.Source("file:///" & App.Path & "/MyPage.html")
Form1.WebView1.NavigateToLocal("file:///" & App.Path & "/MyPage.html")
Form1.WebView1.NavigateToLocal(App.Path & "/MyPage.html")

0 个答案:

没有答案
相关问题