gpt4 book ai didi

c# - 如何在 AvalonEdit 中以编程方式设置代码选择?

转载 作者:行者123 更新时间:2023-11-30 12:16:26 29 4
gpt4 key购买 nike

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

我所说的代码选择是指如果用户用鼠标选择这部分代码,其背景会发生变化。

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

最佳答案

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

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

关于c# - 如何在 AvalonEdit 中以编程方式设置代码选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5433252/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com