1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
if (State.Contains(gdFocused))
{
int MaxColors = 255;
TColor Colors[5] = {RGB(50,50,50),RGB(100,100,100),RGB(150,150,150),RGB(200,200,200),RGB(250,250,250)};
int j;
int x;
int y;
AnsiString A = " ";
AnsiString N = "Chaine d'essai";
y = (Rect.top + Rect.bottom - StringGrid1->Canvas->TextHeight("W")) / 2;
x = (Rect.left + StringGrid1->Canvas->TextWidth("W"));
for(j = 1; j <= N.Length(); j++)
{
StringGrid1->Canvas->Font->Color = Colors[(j-1) % MaxColors];
A[1] = N[j];
StringGrid1->Canvas->TextOut(x,y, A);
x = x + StringGrid1->Canvas->TextWidth(A);
}
}
} |
Partager