【问题标题】:How to set the code selection programatically in AvalonEdit?如何在 AvalonEdit 中以编程方式设置代码选择?
【发布时间】:2011-07-22 22:33:13
【问题描述】:

我在 Microsoft Surface 应用程序中使用 AvalonEdit。由于联系人的处理方式与普通 WPF 应用程序略有不同,因此我想以编程方式设置代码选择。

代码选择是指这部分代码,如果用户用鼠标选择它,它的背景会改变。

我现在是 DocumentLine 或 VisualLine 选择应该开始和结束的地方。但是我现在该如何选择呢?

【问题讨论】:

    标签: c# .net wpf avalonedit


    【解决方案1】:

    this.EditorAvalonEdit 对象,selectionStart 是相对于正在编辑的文本开头的偏移量。

            this.Editor.SelectionStart = selectionStart;
            this.Editor.SelectionEnd = selectionStart + selectionLength;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多