学习使用Wpf开源的文本编辑器—smithhtmleditor

发布时间:2022-07-03 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了学习使用Wpf开源的文本编辑器—smithhtmleditor脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

前言

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

编辑器使用

首先新建一个项目WpfEditor。

然后到Codeplex下载smithhtmleditor。

下载地址:https://Archive.codeplex.COM/?p=smithhtmleditor

学习使用Wpf开源的文本编辑器—smithhtmleditor

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

学习使用Wpf开源的文本编辑器—smithhtmleditor

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

学习使用Wpf开源的文本编辑器—smithhtmleditor

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

学习使用Wpf开源的文本编辑器—smithhtmleditor

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

学习使用Wpf开源的文本编辑器—smithhtmleditor

然后编写代码如下:

<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。

效果图如下:

学习使用Wpf开源的文本编辑器—smithhtmleditor

html格式

学习使用Wpf开源的文本编辑器—smithhtmleditor

上传图片:

&nbsp;

学习使用Wpf开源的文本编辑器—smithhtmleditor

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

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

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

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

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

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

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

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

 

学习使用Wpf开源的文本编辑器—smithhtmleditor

 

脚本宝典总结

以上是脚本宝典为你收集整理的学习使用Wpf开源的文本编辑器—smithhtmleditor全部内容,希望文章能够帮你解决学习使用Wpf开源的文本编辑器—smithhtmleditor所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。