如题

解决方案 »

  1.   

    在大富翁论坛里有答案,具体哪一页我忘了
    www.delphibbs.com(请到大富翁全文搜索www.richsearch.com搜索'高亮显示')
      

  2.   

    帮你找到了,有分吗?
    procedure TForm1.Button1Click(Sender: TObject);
    var
     sString,bgColor:string;
     doc:IHTMLdocument2;
     R:IHTMLTxtRange;
    begin
     sString :='document';  //=Edit1.text; 要查找的字符串,空格都能找
                            //还可以跨边界 比如 <u>docum<b>entdo</b>cument</u>
     bgColor :='magenta';    //=Edit2.text; 也可以是 #FF00FF FFFF00 这种形式
     try
       doc :=IHTMLdocument2(webbrowser1.Document) ;
       R   :=IHTMLTxtRange(doc.selection.createRange);
       while R.findText(sString,1,0) do begin
         R.select;
         R.execCommand('Backcolor',false,bgColor);
         R.setEndPoint('StartToEnd',R);
       end;
     except
     end;