تلوين البحث و التغيير Search And Replace
#2
السلام عليكم
PHP كود :
Const
  
col: array[1..6] of Dword =($0000FF, $008000, $800000,
                              
$FF0000, $FFFF00, $00FF00);
  
{
$WARNINGS OFF} {$HINTS OFF}
{
$O ON}{$OverFlowChecks OFF}
Procedure SearchAndReplace_color(Richedit: TRichEdit; sLookFor, sReplaceWith:string; col: Dword);
          {
$IF CompilerVersion >= 17}Inline;{$IFEND}
Var
  
nPos : Integer;
  
Tmp  : String ;
Begin
nPos
:= Pos(sLookFor, Richedit.Text);
Tmp:= Richedit.Text;
Richedit.Text  := StringReplace(Richedit.Text, sLookFor, sReplaceWith,
                          [
rfReplaceAll, rfIgnoreCase]);
 While (
nPos > 0) do
 
Begin
  With Richedit 
do
   
Begin
    SelStart 
:= nPos - 1 ;
    
SelLength := Length(sReplaceWith);
    
SelAttributes.Color := col;
   
End;

 
nPos := Pos(sLookFor, Tmp);
 
Tmp  := StringReplace(Tmp, sLookFor, sReplaceWith,[rfIgnoreCase]);
 
End;
End; 
بالتوفيق,,
I'M Fly Like A G6

الرد


الردود في هذا الموضوع
تلوين البحث و التغيير Search And Replace - بواسطة TF6M - 18-05-2011, 10:46 AM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم