Ver Mensaje Individual
  #5  
Antiguo 16-10-2006
Avatar de Bicho
[Bicho] Bicho is offline
Miembro Premium
 
Registrado: jul 2003
Ubicación: Inca - Mallorca
Posts: 1.776
Reputación: 24
Bicho Va por buen camino
Hola,

pues debes recorrer el richedit con un bucle, y para cada linea que debas colorear haces uso de las funciones SelStart y SelLenght y después cambias el color con el SelAttributes

Un ejemplo

Código Delphi [-]
var r : Integer;
     Linea : String;
begin
   for r := 0 to richedit2.Lines.count - 1 do begin
      Linea := richedit2.lines.strings[r];
      if  {condicion para que la linea se tenga que pintar} then begin
         richedit2.SelStart := Pos(Linea, RichEdit2.Text); //inicio de donde esta el texto a resalta, en este caso la linea entera
         richedit2.SelLength:=Length(Linea); //longitud del texto
         richedit2.SelAttributes.Color:=clred; //color
      end;
   end
end;

Espero te sirva.


Saludos
Responder Con Cita