protected override void CalcDayCells()
{
DayCells.Clear();
RowCount = GetCellRowCount();
ColumnCount = GetCellColumnCount();
var rightToLeftLayout = WindowsFormsSettings.GetIsRightToLeftLayout(Calendar);
var y = DayCellsBounds.Y;
for (var iRow = 0; iRow < RowCount; ++iRow)
{
var x = rightToLeftLayout ? DayCellsBounds.Right - ActualCellSize.Width : DayCellsBounds.X;
for (var iCol = 0; iCol < ColumnCount; ++iCol)
{
bool correctDate;
if (iRow == 0)
{
if (iCol < PenaltyIndex)
{
x += rightToLeftLayout ? -ActualCellSize.Width : ActualCellSize.Width;
continue;
}
}
DateTime date;
try
{
date = CalcDate(iRow, iCol, out correctDate);
}
catch
{
iRow = RowCount;
break;
}
if (correctDate && CanAddDate(date))
{
var dayCell = (PersianCalendarCellViewInfo)CreateDayCell(date);
dayCell.UpdateVisualState();
dayCell.Bounds = CalcCellBounds(x, y);
dayCell.Text = GetCellText(date, iRow, iCol);
dayCell.ContentBounds = CalcDayCellContentBounds(dayCell.Bounds);
dayCell.CalculateTextBounds();
dayCell.Row = iRow;
dayCell.Column = iCol;
UpdateDayCell(dayCell);
DayCells.Add(dayCell);
CalendarInfo.AddCellToNavigationGrid(dayCell, Row, Column, iRow, iCol);
}
x += rightToLeftLayout ? -ActualCellSize.Width : ActualCellSize.Width;
}
y += ActualCellSize.Height;
}
}