推荐文章

Winform 全屏显示

Winform 全屏显示

Winform程序无边框、置顶、全屏显示
WPF之Image控件

WPF之Image控件

Image控件加载图片包括加载动态图片,加载静态图片两种方式。加载动态图片通过生成一个BitmapImage,创建该对象后,赋给Image的Source即可。加载的形式:BitmapImage myBitmapImage =new BitmapImage();myBitmapImage.BeginInit();取得数据库存储的图片字段,MSSQL的Image类型Byte[] mybyte = Re
wpf list<T>与ObservableCollection<T>的区别

wpf list<T>与ObservableCollection<T>的区别

List《T》与ObservableCollection《T》的用法基本上是一样的。区别:list《T》:当T继承于INotifyPropertyChanged时,如果list《T》中的属性发生改变,则通知UI属性值已发生改变。但当list《T》添加一项时,list《T》就无法通知前端UI了(此时,ObservableCollection《T》闪亮登场)。ObservableCollection《
WPF调用线程复制文件并显示进度条

WPF调用线程复制文件并显示进度条

在WPF中复制文件时,如何调用线程,显示进度条。《Window x:Class="WpfThreadTest.MainWindow"xmlns="http:schemas.microsoft.comwinfx2006xamlpresentation"xmlns:x="http:schemas.microsoft.comwinfx2006xaml"Title="MainWindow" Closed=
WPF中对XML的读写

WPF中对XML的读写

已知有一个XML文件(bookste.xml)如下:《?xmlversion="1.0" encoding="gb2312"?》《bookste》《bookgenre="fantasy" ISBN="236314"》《title》OberonsLegacy《title》《auth》Cets,Eva《auth》《price》5.95《price》《book》《bookste》 1、往《bookste

WPF使用Winform的WebBrowser

日期:2019-03-18 点击:3149 来源:PB2.CN

一、引入dll
System.Windows.Forms.dll和WindowsFormsIntegration.dll。
两个都是.NET框架下的dll,不需要额外下载。
 
二、向界面中添加定义的控件(将导入的dll引入到界面中啦)。

Xaml代码部分:
xmlns:wf ="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
 
//插入Winform的WebBrowser控件
<wfi:WindowsFormsHost Name="winFormsContainer">
<wf:WebBrowser x:Name="webBrowser1"/>
</wfi:WindowsFormsHost>
注意:只有在WindowsFormsHost标签下才能插入WinForm控件。当然你也可以插入其他WinForm控件
 
 三、cs代码段
string html=“你需要展示的html代码”;
 
//调用引入的webBrowser1
webBrowser1.Navigate("about:blank");     //一定要创建一个空白界面。不然即使写入html成功显示也不能再次回读其中内容。
webBrowser1.Document.OpenNew(false);
webBrowser1.Document.Write(html);
webBrowser1.Refresh();
 
//这个时候你可以写js代码来操纵你想要的一切(如下)
String newContent = webBrowser1.Document.GetElementById("container").InnerHtml;
//也可以webBrowser写入html时加入一些css样式

这篇文档对您是否有帮助?

Winform 全屏显示

Winform 全屏显示

Winform程序无边框、置顶、全屏显示
WPF之Image控件

WPF之Image控件

Image控件加载图片包括加载动态图片,加载静态图片两种方式。加载动态图片通过生成一个BitmapImage,创建该对象后,赋给Image的Source即可。加载的形式:BitmapImage myBitmapImage =new BitmapImage();myBitmapImage.BeginInit();取得数据库存储的图片字段,MSSQL的Image类型Byte[] mybyte = Re
wpf list<T>与ObservableCollection<T>的区别

wpf list<T>与ObservableCollection<T>的区别

List《T》与ObservableCollection《T》的用法基本上是一样的。区别:list《T》:当T继承于INotifyPropertyChanged时,如果list《T》中的属性发生改变,则通知UI属性值已发生改变。但当list《T》添加一项时,list《T》就无法通知前端UI了(此时,ObservableCollection《T》闪亮登场)。ObservableCollection《
WPF调用线程复制文件并显示进度条

WPF调用线程复制文件并显示进度条

在WPF中复制文件时,如何调用线程,显示进度条。《Window x:Class="WpfThreadTest.MainWindow"xmlns="http:schemas.microsoft.comwinfx2006xamlpresentation"xmlns:x="http:schemas.microsoft.comwinfx2006xaml"Title="MainWindow" Closed=
WPF中对XML的读写

WPF中对XML的读写

已知有一个XML文件(bookste.xml)如下:《?xmlversion="1.0" encoding="gb2312"?》《bookste》《bookgenre="fantasy" ISBN="236314"》《title》OberonsLegacy《title》《auth》Cets,Eva《auth》《price》5.95《price》《book》《bookste》 1、往《bookste