MatrixGrid->Left = 8;
  //
  int iWidth = (MatrixGrid->DefaultColWidth + 1) * (iSize + 1) + 3;
  if ( Screen->WorkAreaWidth - 16 < iWidth + 32 )
    iWidth = Screen->WorkAreaWidth - 48;
  //
  int iHeight = (MatrixGrid->DefaultRowHeight + 1) * (iSize + 1) + 3;
  if ( Screen->WorkAreaHeight - 16 < MatrixGrid->Top + iHeight +
      ButtonStart->Height + 46 )
    iHeight = Screen->WorkAreaHeight - MatrixGrid->Top -
    ButtonStart->Height - 62;
  //
  MatrixGrid->Width = iWidth;
  MatrixGrid->Height = iHeight;
  //
  ClientHeight = MatrixGrid->Top + MatrixGrid->Height +
    ButtonStart->Height + 16;
  ClientWidth = Max(MatrixGrid->Width + 16, LabelSize->Width + 16);
  //
  ButtonStart->Left = (ClientWidth - ButtonStart->Width)/2;
  //
  Top = (Screen->WorkAreaHeight - Height)/2;
  Left = (Screen->WorkAreaWidth - Width)/2;
  //
  int row, col;
  for (col = 1; col <= iSize; ++col)
    MatrixGrid->Cells[col][0] = AnsiString(col);
  for (row = 1; row <= iSize; ++row)
    MatrixGrid->Cells[0][row] = AnsiString(row);
  MatrixGrid->Visible = true;
}
//---------------------------------------------------------------------------