Days Displayed in the Calendar in Windows Forms MonthCalendarAdv
28 Apr 20212 minutes to read
This page about How to change the days displayed in the calendar and more details.
How to change the days displayed in the calendar?
To change the days displayed in the calendar, you need to handle the PrepareViewStyleInfo event of the Grid control, which is embedded in the MonthCalendarAdv control and change its cell value as follows.
private void Form1_Load(object sender, EventArgs e)
{
foreach (Control ctrl in this.monthCalendarAdv1.Controls)
{
grid = ctrl as GridControl;
if (grid != null)
{
grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo);
break;
}
}
}
void grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (e.Style.Text == "1")
{
e.Style.Text = "a";
}
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
For Each ctrl As Control In Me.monthCalendarAdv1.Controls
grid = CType(IIf(TypeOf ctrl Is GridControl, ctrl, Nothing), GridControl)
If Not grid Is Nothing Then
grid.PrepareViewStyleInfo += New GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo)
Exit For
End If
Next ctrl
End Sub
Private Sub grid_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs)
If e.Style.Text = "1" Then
e.Style.Text = "a"
End If
End Sub