Scheduler for WinForms
選択
Calendar コントロール > 動作 > 選択

The CalendarView control lets you select multiple dates, specific dates, date ranges, weeks etc. CalendarView also lets you set rules to determine the selection behavior while navigating between months. The sub-sections below explains the selection behavior using CalendarView in detail.

Multiple Selection

When selecting multiple days, CalendarView supports contiguous or non-contiguous selection. Contiguous selection lets you select adjacent days, while keeping the SHIFT key pressed. On the other hand, non-contiguous selection lets you select separate days, while keeping the CTRL key pressed.

The image below depicts the CalendarView control when the MaxSelectionCount is set to 3:

Selecting Specific Dates

Let's say, you want to display specific dates to the end-user in the CalendarView. For this purpose, the control allows you to set particular dates using the SelectedDates property in the control.

The code snippet below shows how to use SelectedDates property to display specific dates by setting it to a DateTime array:

C#
コードのコピー
// Add selected dates
c1Calendar1.SelectedDates = new DateTime[]
{
new DateTime(2021, 11, 12),
new DateTime(2021, 11, 13),
new DateTime(2021, 11, 14)
};