DefAttributes (C++)
Description
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.
Code
void __fastcall TForm1::Button1Click(TObject *Sender)
{
RichEdit1->SelAttributes->Color = clRed;
RichEdit1->SelAttributes->Height += 5;
RichEdit1->Lines->Add("This line of text will be read. ");
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
RichEdit1->DefAttributes->Color = clBlue;
RichEdit1->DefAttributes->Style =
RichEdit1->DefAttributes->Style << fsBold << fsItalic;
}
Uses
- Vcl.ComCtrls.TCustomRichEdit.DefAttributes ( fr | de | ja )
- Vcl.ComCtrls.TCustomRichEdit.SelAttributes ( fr | de | ja )
- Vcl.ComCtrls.TTextAttributes.Color ( fr | de | ja )
- Vcl.ComCtrls.TTextAttributes.Height ( fr | de | ja )
- Vcl.ComCtrls.TTextAttributes.Style ( fr | de | ja )