Ładny brzuch

W jaki sposb sprawi, aby poszczeglne wersy komponentu ListView ustawionego ViewStyle = vsReport,GirdLines = True, wywietlane byy innym kolorem?



OwnerDraw na true i piszesz obsluge zdarzenia OnDrawItem:
void __fastcall TForm1::ListView1DrawItem(TCustomListView *Sender,      TListItem *Item, TRect &Rect, TOwnerDrawState State) {    TListView *ListView = dynamic_cast<TListView*>(Sender);    TCanvas *Canvas = Sender->Canvas;    int Index = Item->Index;    Canvas->Font->Color = clWhite;    if(Index%2)      Canvas->Brush->Color = clBlack;    else      Canvas->Brush->Color = clRed;    Canvas->FillRect(Rect);    Canvas->Brush->Style = bsClear;    Rect.Right = ListView->Columns->Items[0]->Width;    Canvas->TextRect(Rect, Rect.Left, Rect.Top+1, ListView->Items->Item[Index]->Caption);    for (int col = 0; col < ListView->Items->Item[Index]->SubItems->Count; col++)      {        Rect.Left = Rect.Left + ListView->Columns->Items[col]->Width + 1;        Rect.Right = Rect.Left + ListView->Columns->Items[col + 1]->Width;        Canvas->TextRect(Rect, Rect.Left, Rect.Top+1, ListView->Items->Item[Index]->SubItems->Strings[col]);      } }

pozdrawiam
pepsi^no1

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • zsf.htw.pl
  •