WPF显示Html
2016-11-23 09:52
127 查看
1.添加引用
WindowsFormsIntegration.dll
System.Windows.Forms.dll
2.界面内容
<UserControl x:Class="HKDCMS.Client.Demo.UIViews.UIControls.AboutUsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
mc:Ignorable="d"
Background="White"
d:DesignHeight="300" d:DesignWidth="300">
<Grid x:Name="grid"> </Grid>
</UserControl>
3.后台代码
public partial class AboutUsControl : UserControl
{
public AboutUsControl()
{
InitializeComponent();
System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
System.Windows.Forms.WebBrowser web = new System.Windows.Forms.WebBrowser();
web.Url = new Uri("http://www.cnblogs.com/");//此处Uri可以是浏览器中的路径,也可以是项目中的html页面路径
host.Child = web;
this.grid.Children.Add(host);
}
}
WindowsFormsIntegration.dll
System.Windows.Forms.dll
2.界面内容
<UserControl x:Class="HKDCMS.Client.Demo.UIViews.UIControls.AboutUsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
mc:Ignorable="d"
Background="White"
d:DesignHeight="300" d:DesignWidth="300">
<Grid x:Name="grid"> </Grid>
</UserControl>
3.后台代码
public partial class AboutUsControl : UserControl
{
public AboutUsControl()
{
InitializeComponent();
System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
System.Windows.Forms.WebBrowser web = new System.Windows.Forms.WebBrowser();
web.Url = new Uri("http://www.cnblogs.com/");//此处Uri可以是浏览器中的路径,也可以是项目中的html页面路径
host.Child = web;
this.grid.Children.Add(host);
}
}
相关文章推荐
- wpf中显示HTML
- WPF显示html的几种方法
- WPF显示html的几种方法
- 有html代码的变量显示字符串而不是html解析显示
- 禁用IE的后退按钮|显示网页已过期|几种语言的实现方法|c#|javascript|html
- C# WPF 显示图片和视频显示 EmuguCv、AForge.Net测试
- 论html页面和javascript编码格式在浏览器中显示
- html ul li 显示数据库
- 让某部分HTML随滚动始终显示在页面上
- html:optionsCollection 的 filter 过滤属性使用心得 - 解决空格不能显示的问题
- 显示初始界面——C# WPF小白学习心得1
- html中轮播时,四个圆点和四个图片对应显示的情况
- 在flex中使用嵌入html文件以解决显示html的问题
- html动态显示提示
- WPF中确保显示TreeView选中的Item
- 【WPF】Datagrid显示最低下一跳
- html显示一个长的错误单词换行,内容自动换行
- atitit.软件开发GUI 布局管理优缺点总结java swing wpf web html c++ qt php asp.net winform
- JS实现HTML页面中动态显示当前时间完整示例
- 关于使用WinHtmlEditor控件获得html代码加载到wpf中webbrowser控件上乱码问题