void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
TStringGrid* pGrid = dynamic_cast<TStringGrid*>(Sender);
AnsiString sText = pGrid->Cells[ACol][ARow];
pGrid->Canvas->FillRect(Rect);
::DrawText(pGrid->Canvas->Handle, sText.c_str(), -1, (RECT*)&Rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
}