Ver Mensaje Individual
  #2  
Antiguo 14-03-2014
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola eennzzoo.

Te hice un ejemplo donde si se encuentra el documento buscado, pone los datos del ListView en color rojo y negrita.
Código:
...
// Configuración echa en el evento OnCreate para clarificar,
// podes realizala desde el Object Inspector en tiempo de diseño. 
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  ListView1->Align = alTop;
  ListView1->Columns->Add();
  ListView1->Columns->Add();
  ListView1->Column[0]->Caption = "DOCUMENTO";
  ListView1->Column[0]->Width   = 100;
  ListView1->Column[1]->Caption = "NOMBRE Y APELLIDO";
  ListView1->Column[1]->Width   = 350;
  ListView1->ViewStyle = vsReport;
}

void __fastcall TForm1::btnFileOpenClick(TObject *Sender)
{
  if (OpenDialog1->Execute()) {
    TListItem *it;
    TStrings *TS = new TStringList;

    ListView1->Items->Clear();
    TS->LoadFromFile(OpenDialog1->FileName);
    
    for(int i= 0; i< TS->Count-1; i+= 3) {
      it = ListView1->Items->Add();
      it->Caption = TS->Strings[i];
      it->SubItems->Add(TS->Strings[i+1]+" "+TS->Strings[i+2]);
    }

    delete TS;
  }
}

void __fastcall TForm1::btnBuscarClick(TObject *Sender)
{
  TListItem *it = ListView1->FindCaption(0,
    Trim(EditDoc->Text), true, true, true);
  if (it) ListView1->ItemIndex = it->Index;
}

void __fastcall TForm1::ListView1AdvancedCustomDrawItem(
      TCustomListView *Sender, TListItem *Item, TCustomDrawState State,
      TCustomDrawStage Stage, bool &DefaultDraw)
{
  TCanvas *CV = Sender->Canvas;

  CV->Font->Style = CV->Font->Style >> fsBold;
  CV->Font->Color = clBlack;
  if (Item->Index == Sender->ItemIndex) {
    CV->Font->Style = CV->Font->Style << fsBold;
    CV->Font->Color = clRed;
  }
}

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita