前言

本文主要介绍使用Wpf文本编辑器——smithhtmleditor。

编辑器使用

首先新建一个项目WpfEditor。

然后到Codeplex下载smithhtmleditor。

下载地址:https://archive.codeplex.com/?p=smithhtmleditor

解压后将SmithHtmlEditor文件夹整个复制。

然后粘贴到我们新建的项目中

然后将该引入SmithHtmlEditor的工程文件。

然后在Com组件中找到Microsoft HTML Object Library,添加引用。

然后编写代码如下:

<Window x:Class="WpfEditor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:smith="clr-namespace:Smith.WPF.HtmlEditor;assembly=Smith.WPF.HtmlEditor"
xmlns:local="clr-namespace:WpfEditor"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<DockPanel DockPanel.Dock="Top" >
<DockPanel.Resources>
<Style TargetType="{x:Type Label}">
<Setter Property="Padding" Value="0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style TargetType="{x:Type Button}">
<Setter Property="Padding" Value="4,2" />
</Style>
</DockPanel.Resources>
<smith:HtmlEditor x:Name="Editor" DockPanel.Dock="Top"/>
</DockPanel>
</Grid>
</Window>

如代码所示,再命名空间中引入了Smith.WPF.HtmlEditor。

xmlns:smith="clr-namespace:Smith.WPF.HtmlEditor;assembly=Smith.WPF.HtmlEditor"

然后使用了Smith.WPF.HtmlEditor程序集下的自定义控件HtmlEditor。

效果图如下:

html格式:

上传图片:

----------------------------------------------------------------------------------------------------

到此,使用Wpf文本编辑器就已经介绍完了。

代码已经传到Github上了,欢迎大家下载。

Github地址: https://github.com/kiba518/WpfEditor

----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------

注:此文章为原创,任何形式的转载都请联系作者获得授权并注明出处!
若您觉得这篇文章还不错,请点击下方的【推荐】,非常感谢!

https://www.cnblogs.com/kiba/p/15399317.html

最新文章

  1. html5页面打包成App - Android或Iphone安装程序
  2. GOLANG 注释
  3. 地图编辑器V1
  4. linux下内网端口转发工具:linux版lcx [实现远程内网维护]
  5. scrollview做定时来回滚动时,总出现错位的情况。
  6. 转载:C/C++源代码到可执行程序的过程详解
  7. 如何添加网站for Linux(绑定域名)
  8. margin系列之keyword auto
  9. 小技巧,把execl.exe转换成dll
  10. 2014年10本月微软MVP应用程序启动!
  11. 前端跨域方案-跨域请求代理(node服务)
  12. C++/C实现各种排序算法(持续更新)--冒泡排序,选择排序,归并排序
  13. mvc模式的理解
  14. Scrapy框架学习第二天
  15. Kotlin入门(28)Application单例化
  16. 为什么可逆矩阵又叫“非奇异矩阵(non-singular matrix)”?
  17. Objective-C 类簇深入理解
  18. Asp: 解决脚本输出网页出现乱码情况
  19. CucumberPeople 1.3.2 发布
  20. [工具]cmd命令大全

热门文章

  1. 面试必问题:JS防抖与节流
  2. python--接口自动化经常用到的pytest框架
  3. 《手把手教你》系列技巧篇(二十三)-java+ selenium自动化测试-webdriver处理浏览器多窗口切换下卷(详细教程)
  4. uniapp 封装 request 并 配置跨域,( 本地 + 线上 + 封装 )
  5. go语言学习代码
  6. session案例之验证码
  7. 回收Windows 10恢复分区之后的磁盘空间
  8. Eclipse中快速生成Javabean的方法
  9. 【OI】竖式问题分析与解答
  10. python字典时间日期