首页 > 解决方案 > 如何使用 ICsharpCode.TextEditor 组件自动完成标签?

问题描述

我已将ICSharpCode.TextEditor.dll组件添加到我的 C# 项目中的 Visual Studio 2017 参考中。接下来,我想找到一种自动完成标签的方法。我在下面提供了一个 GIF 图片来说明我的意思。

在此处输入图像描述

我提供了一个代码,我尝试使用组件本身进行调试,但它不起作用。

if (textEditorControl1.Text.Contains("<html>"))
        {
            textEditorControl1.ActiveTextAreaControl.SelectionManager.SelectedText("</html>");                
        }

ICsharpCode.TextEditor组件没有与普通 Textbox 相同属性

if (textBox2.Text.Contains("<html>"))
        {
            textBox2.SelectedText = "</html>";
        }

如果我尝试调试TextBox版本,我会无数次得到标签,直到我得到一个未处理的 System.StackOverflowException。

标签: c#.nettextboxtext-editoricsharpcode

解决方案


我在这里找到了你要找的东西。唯一的事情是,这是一个普通TextBox的工作代码。


推荐阅读