KOD cpp: UKRYJ
TListItem * ElementListy = ListView1->Items->Add();
ElementListy->Caption = "Pierwszy";
ElementListy->SubItems->Add("---");
ElementListy->SubItems->Add("Kolor czerwony pogrubiona czcionka");
ElementListy->SubItems->Add("Kolor zielony normalna czcionka");
ElementListy->Caption = "Pierwszy";
ElementListy->SubItems->Add("---");
ElementListy->SubItems->Add("Kolor czerwony pogrubiona czcionka");
ElementListy->SubItems->Add("Kolor zielony normalna czcionka");
W zasadzie to chodzi o zmianę koloru już wyplecionych komórek w zależności od statusu. Akcja wykonywana w wątku:
KOD cpp: UKRYJ
if(ststusOK)
{
ListView1->Items->Item[this->nrNaListViev]->SubItems->Strings[1] = "Prawidłowy"; // Kolor zielony
}
else
{
ListView1->Items->Item[this->nrNaListViev]->SubItems->Strings[1] = "Błędny"; // Kolor czerwony
}
{
ListView1->Items->Item[this->nrNaListViev]->SubItems->Strings[1] = "Prawidłowy"; // Kolor zielony
}
else
{
ListView1->Items->Item[this->nrNaListViev]->SubItems->Strings[1] = "Błędny"; // Kolor czerwony
}
KOD cpp: UKRYJ
void __fastcall TForm1::ListView1CustomDrawSubItem(TCustomListView *Sender,
TListItem *Item, int SubItem, TCustomDrawState State, bool &DefaultDraw)
{
if(SubItem == 3)
{
randomize();
if( RandomRange(1, 10) >= 5)
{
Sender->Canvas->Font->Color = clRed;
}
else
{
Sender->Canvas->Font->Color = clGreen;
}
}
}
TListItem *Item, int SubItem, TCustomDrawState State, bool &DefaultDraw)
{
if(SubItem == 3)
{
randomize();
if( RandomRange(1, 10) >= 5)
{
Sender->Canvas->Font->Color = clRed;
}
else
{
Sender->Canvas->Font->Color = clGreen;
}
}
}
Ale mi chodzi o zmianę koloru w komórkach już wypełnionych
