procedure TForm1.FormCreate(Sender: TObject);
var x: integer;
begin
// --------- nur zum Testen -----------
Richedit1.clear;
Richedit1.ScrollBars := ssBoth;
for x := 1 to 9 do
Richedit1.lines.add('Zeile '
+ inttostr(x));
//----------------------------------------------------
end;
procedure FaerbeZeile(RE: TCustomRichedit; Zeile: Integer; Farbe: TColor;
Style: TFontStyles);
var zl: Integer;
begin
zl := pred(Zeile);
with RE do begin
SelStart := Perform(EM_LINEINDEX, zl, 0);
SelLength := Length(Lines[zl]);
SelAttributes.Color := Farbe;
SelAttributes.Style := Style;
SelLength := 0;
end;
end;
// Beispielaufruf
procedure TForm1.Button1Click(Sender: TObject);
begin
FaerbeZeile(Richedit1, 2, clBlue, [FsBold, fsItalic]);
FaerbeZeile(Richedit1, 6, clFuchsia, [fsBold]);
end;