Category / Section
How to customize the appearance of dates in the WinForms MonthCalenderAdv?
1 min read
Appearance and selection of date cell
The appearance and selection of a Date cell can be customized in the MonthCalenderAdv by handling the DateQueryCellInfo event. The following code example demonstrates the same.
C#
private void monthCalendarAdv1_DateCellQueryInfo(object sender, Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventArgs e) { //Helps customize the MonthCalenderAdv DateCells. if (e.RowIndex == 3 && e.ColIndex > 2) { e.Style.BackColor = Color.Snow; //Disables Date cell selection. e.Style.Enabled = false; //Sets Unselectable Date cells BackColor. e.Style.BackColor = Color.FromArgb(13, 134, 64); } }
VB
Private Sub monthCalendarAdv1_DateCellQueryInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventArgs) Handles monthCalendarAdv1.DateCellQueryInfo 'Helps customize the MonthCalenderAdv DateCells. If e.RowIndex = 3 AndAlso e.ColIndex > 2 Then e.Style.BackColor = Color.Snow 'Disables Date cell selection. e.Style.Enabled = False 'Sets Unselectable Date cells BackColor. e.Style.BackColor = Color.FromArgb(13, 134, 64) End If End Sub
Figure 1: Customized MonthCalenderAdv