Private Sub DrawDays
cvsBackground.DrawColor(Colors.Transparent)
cvs.DrawColor(Colors.Transparent)
Dim firstDay As Long = DateUtils.SetDate(year, month, 1) - 1
dayOfWeekOffset = DateTime.GetDayOfWeek(firstDay) Mod 7
daysInMonth = DateUtils.NumberOfDaysInMonth(month, year)
If year = selectedYear AND month = selectedMonth Then
'draw the selected box
DrawBox(cvs, selectedColor, (selectedDay - 1 + dayOfWeekOffset) Mod 7, _
(selectedDay - 1 + dayOfWeekOffset) / 7)
End If
For day = 1 To daysInMonth
Dim row As Int = (day - 1 + dayOfWeekOffset) / 7
cvs.DrawText(day, (((dayOfWeekOffset + day - 1) Mod 7) + 0.5) * boxW, _
(row + 0.5)* boxH + vCorrection, Typeface.DEFAULT_BOLD, Label1.TextSize, Colors.Black, "CENTER")
Next
' Dim firstWeek, lastWeek As Int
' firstWeek = DateTime.GetDayOfYear(DateUtils.SetDate(year, month, 1)) / 7 + 1
' lastWeek = DateTime.GetDayOfYear(DateUtils.SetDate(year, month, daysInMonth)) / 7 + 1
' For week = firstWeek To lastWeek
' Log(week)
' Next
DaysPanel.Invalidate
End Sub