惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Google DeepMind News
Google DeepMind News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog
U
Unit 42
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
G
Google Developers Blog
I
InfoQ
Blog — PlanetScale
Blog — PlanetScale
A
About on SuperTechFans
Jina AI
Jina AI
量子位
宝玉的分享
宝玉的分享
The Cloudflare Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 聂微东
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
美团技术团队
The Hacker News
The Hacker News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Tailwind CSS Blog
博客园 - 司徒正美
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
P
Palo Alto Networks Blog
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
Spread Privacy
Spread Privacy
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
Vercel News
Vercel News
Martin Fowler
Martin Fowler
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Forbes - Security
Forbes - Security
Attack and Defense Labs
Attack and Defense Labs
Google DeepMind News
Google DeepMind News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
P
Privacy International News Feed
G
GRAHAM CLULEY
The Last Watchdog
The Last Watchdog
C
Cyber Attacks, Cyber Crime and Cyber Security
AI
AI
V2EX - 技术
V2EX - 技术

博客园 - 涂磊

02]AdvStringGrid中添加CheckBox 01]TMSadvStringGrid下载与安装 epson投影仪提示,保存时间的电池电量偏低,取消显示 用DeepSeek做的Delphi闹钟 XboxS联网下载完游戏后,要拔掉网线,就能玩游戏了 delphi10.3中Tmemo中某些文本显示下划线 delphi的TReeView支持鼠标拖动节点 cnPack里MarkDown里RTF显示 11]delphi中 RichEdit1设置行距 10]RichEdit另存 为BMP图片 09]delphi中richedit查找 08]delphi10.3剪贴板的图片,保存到文件 07]Delphi10.3中Richedit中的链接可以点击 06]delphi10.3中richedit中文本背景颜色 05]delphi10.3中richedit中删除线 delphi10.3中UpDown1使用 04]RichEdit的上标和下标,Delphi10.3 03]RichEdit插入BMP图片 delphi 中tButtonColor颜色选择 02]如何设置RichEdit文本颜色?_编程语言-CSDN问答 01]delphi从TRichEdit获得RTF格式文本(PC版本) Delphi10.3接收从文件管理器拖放过来的文件名
12]RichEdit某些文本突出显示
涂磊 · 2026-03-21 · via 博客园 - 涂磊

image

procedure TMainForm.ToolButton18Click(Sender: TObject);
var
  FoundPos: Integer;
  SearchText: string;
  StartPos: Integer;
  SearchOptions: TSearchTypes;
begin
  SearchText := Edit2.Text;
  if SearchText = '' then Exit;

  // 先重置所有文本颜色为黑色
  editor.SelStart := 0;
  editor.SelLength := Length(editor.Text);
  editor.SelAttributes.Color := clBlack;

  // 设置查找选项
  SearchOptions := [stMatchCase]; // 根据需要添加选项

  StartPos := 0;
  while True do
  begin
    // 从 StartPos 开始查找
    FoundPos := editor.FindText(
      SearchText,
      StartPos,
      Length(editor.Text) - StartPos,
      SearchOptions
    );

    if FoundPos = -1 then
      Break; // 没找到就退出

    // 高亮找到的词
    editor.SelStart := FoundPos;
    editor.SelLength := Length(SearchText);
    editor.SelAttributes.Color := clRed;

    // 移动起始位置,继续往后找(跳过已找到的词)
    StartPos := FoundPos + Length(SearchText);

    // 防止死循环(如果关键词长度为0)
    if Length(SearchText) = 0 then
      Break;
  end;

  // 取消选中状态
  editor.SelLength := 0;
  editor.SelStart := 0;
end;

发表于 2026-03-21 14:02  涂磊  阅读(8)  评论()    收藏  举报