Try the following:
Private Sub pintaCalendarioNaData(ByRef mc As MonthCalendar, ByVal data As Date, ByVal cor As String) Dim gMonthCalendar As Graphics = mc.CreateGraphics() Dim oHTIMonths As MonthCalendar.HitTestInfo Dim arrDates As New ArrayList() Try For intRows As Integer = 1 To mc.Size.Width - 1 For intCols As Integer = 1 To mc.Size.Height - 1 oHTIMonths = mc.HitTest(intRows, intCols) If oHTIMonths.HitArea = MonthCalendar.HitArea.Date Then If CDate(mc.HitTest(intRows, intCols).Time) = CDate(data) Then gMonthCalendar.DrawRectangle(New Pen(ColorTranslator.FromHtml(cor), 2), intRows, intCols, 24, 15) GoTo fim End If End If Next intCols Next intRows fim: Catch ex As Exception MessageBox.Show("Error: " & vbNewLine & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Err.Clear() Finally End Try End Sub
This sub-color highlights one MonthCalendar (mc) for one specific date (data) with one color (cor)
Ricardo rodrigues
source share