RAD Studio VCL Reference
|
Indicates the foreground color of the text.
property Color: TColor;
__property TColor Color;
Use color to indicate the color of the actual characters.
C++ Examples:
/* This example requires a TRichEdit and two TButtons. Leave the default text, usually "RichEdit1", in the lines property. The DefAttributes will apply to this text. */ void __fastcall TForm1::Button1Click(TObject *Sender) { RichEdit1->SelAttributes->Color = clRed; RichEdit1->SelAttributes->Height += 5; RichEdit1->Lines->Add("This line of text will be red. "); } void __fastcall TForm1::Button2Click(TObject *Sender) { RichEdit1->DefAttributes->Color = clBlue; RichEdit1->DefAttributes->Style = RichEdit1->DefAttributes->Style << fsBold << fsItalic; }
Delphi Examples:
{ This example requires a TRichEdit and two TButtons. Leave the default text, usually "RichEdit1", in the lines property. The DefAttributes will apply to this text. } procedure TForm1.Button1Click(Sender: TObject); begin with RichEdit1.SelAttributes do begin Color := clRed; Height := Height + 5; end; RichEdit1.Lines.Add('This line of text will be red.'); end; procedure TForm1.Button2Click(Sender: TObject); begin RichEdit1.DefAttributes.Color := clBlue; RichEdit1.DefAttributes.Style := [fsBold, fsItalic]; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|