C#winforms应用程序中的动态网页 [英] Dynamic web pages within a C# winforms app

查看:62
本文介绍了C#winforms应用程序中的动态网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Winforms应用程序,我想向其中添加一些新功能.

I have a winforms app that I would like to add some new features to.

理想情况下,我将拥有一个具有嵌入式浏览器控件的新表单.我希望从应用程序本身(而不是远程服务器)提供"浏览器中的页面.

Ideally I would have a new form that would have an embedded browser control. I want the pages in the browser to be 'served' from the app itself ( as opposed to a remote sever ).

页面将根据应用程序中的数据动态创建.

The pages will be dynamically created dependent on data from within the App.

此外,如何满足对CSS,Javascript和Image文件等资产的引用.理想情况下,这些也需要由应用程序处理.

Also, how do I cater for references to assets like CSS, Javascript and Image files. Ideally these would need to be handled by the application as well.

我该怎么做?

推荐答案

使用 WebBrowser 控件.

您可以设置 DocumentText 属性设置为您要显示的HTML.(感谢@Anton Semenov).

You can set the DocumentText property to the HTML you want to display. (thanks @Anton Semenov).

或者,您可以从应用程序创建的文件中向其提供本地文件URL.

Alternatively, you can feed it local file URLs from files that your application creates.

这篇关于C#winforms应用程序中的动态网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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