Rich - funcao para adicionar texto de uma cor específica |
Top Previous Next |
|
procedure AddText(const Texto: string; const Cor: TColor; RichEdit: TRichEdit); begin RichEdit.SelLength := 0; RichEdit.SelAttributes.Color := Cor; // Set the selected text color RichEdit.SelText := Texto; // Add the text RichEdit.SelAttributes.Color := clWindowText; // Set the selected text back to the default end;
procedure TForm1.Button1Click(Sender: TObject); begin AddText('This text is RED!', clRed, RE) end; |