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有这个功能麻烦在下面留个言,谢了!
        已修改,多谢  谢方 同志!
  • 相关阅读:
    oc复习
    oc复习(琐碎)
    nodejs中express框架
    mac 下subline text 3最新版本激活码
    mac eclipse 修改SDK路径
    MAC下 ant 环境搭建
    nodejs npm命令行总结
    ios开发之短信验证
    ios开发之调用相机和本地相册
    ios8新特性之毛玻璃效果
  • 原文地址:https://www.cnblogs.com/mrhgw/p/1576321.html
Copyright © 2011-2022 走看看