如何使用.net的网页浏览器控制?

发布于 2024-11-26 12:09:27 字数 150 浏览 5 评论 0原文

我在.net中使用winforms。我正在尝试使用 C++ 在网络浏览器控件中创建一个 html 页面。当我执行此操作时出现错误

webBrowser1->Document = "hi";

如何创建 html 页面并使用 Web 浏览器控件显示它?

i am using winforms in .net. I am trying to create a html page in web browser control using c++. I am getting error when i do this

webBrowser1->Document = "hi";

how to create a html page and display it using web browser control?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

在你怀里撒娇 2024-12-03 12:09:27

webBrowser1->Document 需要 HtmlDocument,但你给了它一个字符串。另外,文档 property 是只读的(未定义 setter),因此无法设置。

请尝试以下操作:

webBrowser1->DocumentText = "<html><body>hi</body></html>";

请注意,这使用 DocumentText 属性而不是 Document 属性。

webBrowser1->Document expects an HtmlDocument, but you gave it a string. Also, the Document property is read-only (no setter defined), so it cannot be set.

Try this instead:

webBrowser1->DocumentText = "<html><body>hi</body></html>";

Notice that this uses the DocumentText property instead of the Document property.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文