Mensaje    Asunto: Estilos (negrita, subrayado...) para TQRRichText Responder citando

Gracias a la ayuda otro foro puedo poner el código para añadir estilos a un TQRRichText. Suponemos que el TQRRichText está en otro formulario diferente.
    1. Preparación del campo
    Código:
    TRichEdit *Rich = new TRichEdit(this);
    Rich->Parent    = this;
    Rich->Visible   = false;
    Rich->Lines->Add(<El texto que se quiera añadir>);
    Estilo(Rich, Texto, <Estilo>);
    Form1->QRRichText->ParentRichEdit = Rich;
    Form1->QuickRep1->Preview();

    2. Función (yo la tengo definida en un módulo aparte y la llamo con extern)
    Código:
    void Estilo(TRichEdit *Rich, AnsiString Texto, TFontStyle fStyle)
    {
         Rich->SelStart             = Rich->FindText(Texto, 0, Rich->GetTextLen(), TSearchTypes() << stMatchCase);
         Rich->SelLength            = Texto.Length();
         Rich->SelAttributes->Style = Rich->SelAttributes->Style << fStyle;
    }
    //---------------------------------------------------------------------------

<Estilo> se pasa como fsBold, fsUnderline, etc. Gracias a ecfisa de Foros Culb Delphi.
_________________
Un saludo

Necesitamos tu ayuda: Envía AI al 27595 (Coste 1,20 euros + IVA)