Eit*_*tan 6 .net c# wpf winforms
我想在表单上显示HTML部分.我在网上看了几个关于使用网络表单或文档布局等的例子,但没有什么对我有用.
我们的网站上有一个系统,用户可以使用真实文本编辑器(CKEditor)输入通知.消息保存在数据库中,办公室中所有计算机上的WPF应用程序都应显示该消息.
我想在我的WPF程序中支持HTML.HTML不在页面中,它是db中的一段HTML,需要在WPF应用程序上以其呈现的形式显示.
例如,如果有人输入<img src="http://www.google.com/google.jpg" />
它,当我从数据库中检索它并在表单上显示时,它将在wpf应用程序中显示该图像.
最好的方法是什么?
PS我无法使用Web浏览器,因为Windows将"AllowTranparency"设置为true.
将WebBrowser控件添加到您的应用程序:
<Window x:Class="WpfBrowser.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<WebBrowser Height="311" HorizontalAlignment="Left" Name="webBrowser1" VerticalAlignment="Top" Width="503" />
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
然后使用NavigateToString
的WebBrowser
从你的HTML字符串加载页面:
webBrowser1.NavigateToString("<html><head></head><body>First row<br>Second row</body></html>");
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8856 次 |
最近记录: |