var
  gStart, gLength, gCol: Integer; procedure SetRichEdit(aRichEdit: TRichEdit);
var
  fRow, fCol: Integer;
  fStart, fLength, tStart: Integer;
begin
  fRow := aRichEdit.CaretPos.X;
  fCol := aRichEdit.CaretPos.Y;
  if gCol = fCol then Exit;
  if aRichEdit.SelLength > then Exit;   tStart := aRichEdit.SelStart;
  fStart := tStart - fRow;
  fLength := aRichEdit.Lines[fCol].Length;   aRichEdit.Lines.BeginUpdate;   if fLength > then
  begin
    aRichEdit.SelStart := fStart;
    aRichEdit.SelLength := fLength;
    aRichEdit.SelAttributes.Color := clRed;
  end;   if gLength > then
  begin
    aRichEdit.SelStart := gStart;
    aRichEdit.SelLength := gLength;
//    aRichEdit.SelectAll;
    aRichEdit.SelAttributes.Color := clBlack;
  end;   aRichEdit.SelStart := tStart;
  aRichEdit.SelLength := ;   aRichEdit.Lines.EndUpdate;   gStart := fStart;
  gLength := fLength;
  gCol := fCol;
end; procedure TForm1.RichEdit1Click(Sender: TObject);
begin
  SetRichEdit(TRichEdit(Sender));
end; procedure TForm1.RichEdit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  if Key in [..] then SetRichEdit(TRichEdit(Sender));
end;

高亮 TRichEdit 当前行的更多相关文章

  1. PL/SQL显示行号和高亮当前行

    PL/SQL Developer 如何显示行号: PL/SQL Developer 高亮当前行: OK!

  2. codeblocks设置当前行高亮

    默认是不开启当前行高亮的. 如果想打开,选择:Settings>Editor>Editor Settings>Other options> 勾选Highlight line u ...

  3. Excel 高亮当前行、高亮重复行的探索

    本文原创,转载请注明出处:https://www.cnblogs.com/wotent/p/15348891.html TLDR 下载文件 高亮.zip ,将解压后的"高亮.xlam&quo ...

  4. Vxe-table 高亮当前行

    需求 1 :设置初始高亮 子组件: 父组件 需求 2 :高亮行的变化,需要把数据传递到兄弟组件中 解决办法:EventBus 参考链接: http://t.csdn.cn/iwOJc main.js ...

  5. Excel 当前行高亮

    格式-条件格式-条件(公式)- =ROW()=CELL("row") 再选颜色...即可.

  6. Table表格滑过当前项[当前行][当前列]对应高亮

    效果演示图: JS 代码如下: function TableHover($table){       $table.mouseenter(function(event) {            va ...

  7. vim的高亮查找操作

    使用了VIM这么久,却一直无法牢记一些基本的操作指令.今天查找一个关键字时,想不起来怎么查找“下一个”,于是google之并解决,顺便把有用的都贴过来罢. 查找指令:/xxx 往下查找?xxx 往上  ...

  8. MWeb 1.5 发布!增加打字机滚动模式、发布到 Evernote、印象笔记、Wordpress.com、Blogger、编辑器内代码块语法高亮

    打字机滚动模式(Typewriter Scrolling) 快捷键:CMD + Option + T,菜单:View - Typewriter Scrolling ,效果如下图: 发布到 Everno ...

  9. [Linux] vim的高亮查找操作

    reference :  http://blog.chinaunix.net/uid-20732478-id-763411.html 使用了VIM这么久,却一直无法牢记一些基本的操作指令.今天查找一个 ...

随机推荐

  1. js实例:验证只能输入数字和一个小数点

    分享一个javascript脚本代码,用于验证只能输入数字和一个小数点,检测数字输入是否符合要求,效果不错,有用到的朋友拿去吧. 原文地址:http://www.jbxue.com/article/1 ...

  2. Struts 2学习笔记——拦截器相关

    一.添加国际化支持 默认的struts-deault.xml文件中已经定义了国际化拦截器,内容如下 <!-定义国际化拦截器--> <interceptor name="i1 ...

  3. c# long转 datetime

    ; DateTime start = , , , , , , DateTimeKind.Utc); DateTime date = start.AddMilliseconds(time).ToLoca ...

  4. Android开发工具全面转向Android Studio(3)——AS project/module的目录结构(与Eclipse对比)

    如果AS完全还没摸懂的,建议先看下Android开发工具全面转向Android Studio(2)——AS project/module的CRUD. 注:以下以Windows平台为标准,AS以目前最新 ...

  5. JavaSE知识结构

  6. 深入浅出Node.js(一):什么是Node.js

    Node.js从2009年诞生至今,已经发展了两年有余,其成长的速度有目共睹.从在github的访问量超过Rails,到去年底Node.jsS创始人Ryan Dalh加盟Joyent获得企业资助,再到 ...

  7. .NET entityframework for mysql ,datetime字段存储值时有误差

    昨天Tester发现数据有问题,大部分时间“datetime类型”都多了一秒,很少一部分数据的时间能完全对上(年月日时分秒),因为缺少关键日志,就各种排查,最后发现在调用Savechange方法前一刻 ...

  8. ctrip

    #-*-coding:utf8-*-from lxml import etreeimport requestsimport re#编码转换import sysreload(sys)sys.setdef ...

  9. react-router配合webpack实现按需加载

    很久没有写博客了.一直感觉没有什么要写的,但是这个东西确实有必要的.使用react开发,不可能一直打包到一个文件.小项目肯定没有问题,但是变大一旦到几兆,这个问题就很严重.现在又Commonjs,AM ...

  10. C++基础知识易错点总结(1)

    1. 在C++中,不能被重载的运算符有: sizeof . 成员运算符 .* 成员指针运算符 :: 作用域运算符 ?: 条件运算符 2. C++语言多态性:编译时多态和运行时多态: 编译时多态可通过函 ...