MonthCalendar.SelectionEnd 속성

정의

선택한 날짜 범위의 끝 날짜를 가져오거나 설정합니다.

public:
 property DateTime SelectionEnd { DateTime get(); void set(DateTime value); };
[System.ComponentModel.Browsable(false)]
public DateTime SelectionEnd { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.SelectionEnd : DateTime with get, set
Public Property SelectionEnd As DateTime

속성 값

선택 영역에서 마지막 날짜를 나타내는 DateTime입니다.

특성

예외

날짜 값이 MinDate 값보다 작습니다.

또는

날짜 값이 MaxDate 값보다 큽니다.

예제

다음 코드 예제를 사용 SelectionStart 하는 방법을 보여 줍니다는 및 SelectionEnd 속성입니다. 예제를 실행하려면 다음 코드를 라는 컨트롤이 MonthCalendar 포함된 폼에 붙여넣고 폼의 생성자 또는 Load 이벤트 처리 메서드에서 메서드를 호출 ShowAWeeksVacationOneMonthFromTodayMonthCalendar1합니다.

// Computes a week one month from today.
void ShowAWeeksVacationOneMonthFromToday()
{
   DateTime today = this->MonthCalendar1->TodayDate;
   DateTime vacationStart = today.AddMonths(1);
   DateTime vacationEnd = vacationStart.AddDays(7);

   // Select the week using SelectionStart and SelectionEnd.
   this->MonthCalendar1->SelectionStart = vacationStart.AddDays(-1);
   this->MonthCalendar1->SelectionEnd = vacationEnd.AddDays(-1);
}
// Computes a week one month from today.
private void ShowAWeeksVacationOneMonthFromToday()
{
    DateTime today = this.MonthCalendar1.TodayDate;
    DateTime vacationStart = today.AddMonths(1);
    DateTime vacationEnd = vacationStart.AddDays(7);

    // Select the week using SelectionStart and SelectionEnd.
    this.MonthCalendar1.SelectionStart = vacationStart.AddDays(-1);
    this.MonthCalendar1.SelectionEnd = vacationEnd.AddDays(-1);
}

' Computes a week one month from today.
Private Sub ShowAWeeksVacationOneMonthFromToday()
    Dim today As Date = monthCalendar1.TodayDate
    Dim vacationStart = today.AddMonths(1)
    Dim vacationEnd = vacationStart.AddDays(7)

    Me.monthCalendar1.SelectionStart = vacationStart.AddDays(-1)
    Me.monthCalendar1.SelectionEnd = vacationEnd.AddDays(-1)
End Sub

설명

속성 값을 속성의 SelectionEnd 현재 값 SelectionStartSelectionStart 보다 이전 날짜로 설정하면 가 자동으로 로 설정 SelectionEnd됩니다.

선택 영역이 속성에 SelectionEnd 지정된 MaxSelectionCount 일 수를 초과하는 날짜를 설정하면 값 SelectionStart 이 조정되고 SelectionStart 선택한 일수가 와 같 MaxSelectionCount도록 값이 자동으로 설정됩니다.

참고

MaxSelectionCount는 선택 영역의 일 수를 나타내며, 와 SelectionEndSelectionStart 차이는 나타냅니다. 예를 들어 가 7(기본값)SelectionStart이면 MaxSelectionCountSelectionEnd 는 6일 이내일 수 있습니다.

참고

SelectionRange 비주얼 스타일을 사용하도록 설정된 컨트롤의 MonthCalendar 를 설정하면 선택 범위가 컨트롤에 올바르게 그려지지 않습니다.

적용 대상

추가 정보