zoukankan      html  css  js  c++  java
  • ICSharpCode.TextEditor设置选择的文本

        翻遍了ICSharpCode.TextEditor源码,居然没找到选择指定文本的现成的方法,可能我还不熟悉源码或运气不好没找到相关方法,只好自己动手了。
      
                //设置选择的文本。
                Point start = this.CurrentTextEditor.Document.OffsetToPosition(offset);
                Point end 
    = this.CurrentTextEditor.Document.OffsetToPosition(offset + length);
                
    this.CurrentTextEditor.ActiveTextAreaControl.SelectionManager.SetSelection(new DefaultSelection(this.CurrentTextEditor.Document, start, end));

                
    //滚动到选择的位置。
                this.CurrentTextEditor.ActiveTextAreaControl.Caret.Position = end;
                
    this.CurrentTextEditor.ActiveTextAreaControl.TextArea.ScrollToCaret();           

        注释已经很详细了,希望对有需要的人有所帮助。如果哪位同志知道ICSharpCode.TextEditor有这个功能麻烦在下面留个言,谢了!
        已修改,多谢  谢方 同志!
  • 相关阅读:
    数据科学家成长指南(下)
    数据科学家成长指南(中)
    数据科学家成长指南(上)
    数据分析的职业规划
    2018的内容写作方向
    乱码 设置编码
    CI 如何获取get请求过来的数据
    ci 打印出常用的变量
    CI $_GET
    获取checkbox 组成字符串
  • 原文地址:https://www.cnblogs.com/mrhgw/p/1576321.html
Copyright © 2011-2022 走看看