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有这个功能麻烦在下面留个言,谢了!
        已修改,多谢  谢方 同志!
  • 相关阅读:
    ARM处理器
    进程和线程通俗理解
    const与指针
    字符提取命令
    ThinkPHP之视图模版的使用
    ThinkPHP之MVC与URL访问
    ThinkPHP之项目搭建
    android之文件存储和读取
    cryptdb中wrapper.lua的分析
    cryptDB安装分析
  • 原文地址:https://www.cnblogs.com/mrhgw/p/1576321.html
Copyright © 2011-2022 走看看