如何将 <iframe> HTML 代码嵌入到 C# 应用程序中?

新手上路,请多包涵

如何最有效地将 HTML iframe 嵌入到我的 C# 应用程序中。

让我们说这个 youtube 视频:

 <iframe width="560" height="315" src="//www.youtube.com/embed/UJ53Js0YKZM" frameborder="0" allowfullscreen></iframe>

我试过这个但没有用:

 Private Sub InitializeComponent()
    Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmAbout))
    '
    'frmVirtual
    '
    Me.Text = "Virtual"
    Me.VirtualView = New WebBrowser
    Me.VirtualView.Navigate("<iframe src='https://www.google.com/maps/embed?pb=!1m0!3m2!1sen!2sau!4v1481252003737!6m8!1m7!1sF%3A-pwYGx-oWTIk%2FWC6LeJuIxdI%2FAAAAAAAABIg%2FphppDvMZr54JiWnLbsbUgDcTGUfGXLMRACLIB!2m2!1d-33.76525136331761!2d150.9088391438127!3f310!4f0!5f0.7820865974627469' width='600' height='450' frameborder='0' style='border: 0' allowfullscreen></iframe>")

   Me.SuspendLayout()
End Sub

C# 应用程序当然是 Windows 窗体应用程序。它不一定是视频,当然也可以是带有链接的小横幅,当然是在 Iframe 中。请帮忙!

原文由 Mr. Curious 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 456
1 个回答
<iframe visible="true" runat="server" id="yourid" style="visibility:hidden;display:block;width:1px;height:1px;"></iframe>

yourid.Attributes.Add("src", "youtube.com");

原文由 eren 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题