Thema: Delphi TRichEdit

Einzelnen Beitrag anzeigen

blink182

Registriert seit: 19. Jun 2007
126 Beiträge
 
Delphi 5 Standard
 
#2

Re: TRichEdit

  Alt 26. Feb 2009, 21:58
Delphi-Quellcode:
procedure AddColoredText(Text: String; Color: TColor; const
  NewLn: Boolean = true);
begin
  if NewLn then
  begin
    Form1.RIchEdit1.Lines.Add(Text);
  end
    else
  begin
    Form1.RIchEdit1.Lines[Form1.RIchEdit1.Lines.Count -1] := Form1.RIchEdit1.Lines[Form1.RIchEdit1.Lines.Count -1]
      + Text;
  end;
  Form1.RIchEdit1.SelStart := Length(Form1.RIchEdit1.Lines.Text) -2 -Length(Text);
  Form1.RIchEdit1.SelLength := Length(Text);
  Form1.RIchEdit1.SelAttributes.Color := Color;
  Form1.RIchEdit1.SelLength := 0;
  Form1.RIchEdit1.SelStart := Length(Form1.RIchEdit1.Lines.Text);
end;
probier die Prozedur mal, damit kannst du einzelne Teile einer Reihe färben oder halt die ganze Reihe, je nach dem was du der Konstanten zuweißt.
Hier wirds aber auch nochmal genau erklärt http://www.swissdelphicenter.ch/torr...de.php?id=1129
  Mit Zitat antworten Zitat