Ver Mensaje Individual
  #2  
Antiguo 19-04-2005
Avatar de barman
barman barman is offline
Miembro
 
Registrado: may 2003
Posts: 139
Reputación: 22
barman Va por buen camino
Ni idea de lo que me cuentas, pero a ver si te vale esto, yo lo uso para marcar dentro de un texto como si se tratase de un marcador.

CuandoQuieras(){
TPoint Pos = RichEdit1->CaretPos;
PintarFondoLinea(RichEdit1, Pos.y +1, clYellow);}


void __fastcall TFRichText::PintarFondoLinea(TRichEdit *RichEdit, int Linea, TColor Color)
{
// Seleccionamos la linea
int iStart = RichEdit->Perform(EM_LINEINDEX, Linea-1, 0);
int iEnd = RichEdit->Perform(EM_LINEINDEX, Linea, 0);
RichEdit->Perform(EM_SETSEL, iStart, iEnd );

::CHARFORMAT2 cf;
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_BACKCOLOR;
cf.crBackColor = ColorToRGB(Color);
RichEdit->Perform(EM_SETCHARFORMAT, SCF_SELECTION, (int)&cf);

RichEdit1->SelStart = iEnd ;

cf.cbSize = sizeof(cf);
cf.dwMask = CFM_BACKCOLOR;
cf.crBackColor = ColorToRGB(clWhite);
RichEdit1->Perform(EM_SETCHARFORMAT, SCF_SELECTION, (int)&cf);


}
Responder Con Cita