personaliser un StringGrid
Bonjour,
Je cherche à personnaliser un StringGrid, de façon simple.
Je voudrais que la colonne 3 soit colorée en rouge clair... tout simplement.
J'ai trouver dans la F.A.Q quelque chose, j'ai essayé de l'adapter mais sans succès...
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| void __fastcall TForm_Tab_Clients::StringGridDrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
pGrille = (TStringGrid* )Sender;
if (!pListeIndex == NULL)
{
// Si l'index de la ligne dessinée correspond à une ligne sélectionnée, on
// retrouve la valeur de son index dans la TStringList
if (pListeIndex->IndexOf(ARow)!= - 1)
{
//elle est déssinée avec une couleur de fond et une fonte spécifique
pGrille->Canvas->Brush->Color = clHighlight;
pGrille->Canvas->Font->Color = clWhite;
pGrille->Canvas->FillRect(Rect);
pGrille->Canvas->TextRect(Rect, Rect.Left+2, Rect.Top+2, pGrille->Cells[ACol][ARow]);
}
}
else
{
pGrille->Canvas->Brush->Color = clWindow;
pGrille->Canvas->Font->Color = clBlack;
}
TRect R1;
TRect R2;
AnsiString t;
StringGrid->Canvas->Font->Color=clBlack;
StringGrid->Canvas->Font->Size=8;
if (ACol==3)
{
StringGrid->Canvas->Font->Color = clRed;
StringGrid->Canvas->Font->Size=8;
StringGrid->Canvas->TextRect(Rect, Rect.Left , Rect.Top , StringGrid->Cells[ACol][ARow]);
}
} |
Est ce que quelqu'un pourrai m'aider?
Merci par avance...