2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
Disable or hide the previous and next month datesBy default, the trailing date (previous and next months' dates) is visible in the drop-down calendar of the DateTimePickerAdv. You can hide the trailing dates by setting forecolor of trailing dates to White in the DateCellQueryInfo event. The following code example demonstrates how to hide trailing dates in the drop-down calendar of the DateTimePickerAdv. C# this.dateTimePickerAdv1.Calendar.DateCellQueryInfo += new DateCellQueryInfoEventHandler(Calendar_DateCellQueryInfo); /// <summary> /// Event to provide custom formatting for calendar cells. /// </summary> void Calendar_DateCellQueryInfo(object sender, DateCellQueryInfoEventArgs e) { if (e.Style.TextColor == this.dateTimePickerAdv1.CalendarTrailingForeColor) { // Hide the trailing dates e.Style.Enabled = false; e.Style.TextColor = Color.White; } } VB AddHandler dateTimePickerAdv1.Calendar.DateCellQueryInfo, AddressOf Calendar_DateCellQueryInfo ''' <summary> '''Event to provide custom formatting for calendar cells. ''' </summary> Private Sub Calendar_DateCellQueryInfo(ByVal sender As Object, ByVal e As DateCellQueryInfoEventArgs) If e.Style.TextColor = Me.dateTimePickerAdv1.CalendarTrailingForeColor Then 'Hide the trailing dates e.Style.Enabled = False e.Style.TextColor = Color.White End If End Sub
Sample: C#: http://www.syncfusion.com/downloads/support/directtrac/general/ze/CS-1146374136 VB: http://www.syncfusion.com/downloads/support/directtrac/general/ze/VB-1476170831 |
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.