SelectionRange 클래스

정의

MonthCalendar 컨트롤의 날짜 선택 범위를 나타냅니다.

public ref class SelectionRange sealed
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.SelectionRangeConverter))]
public sealed class SelectionRange
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.SelectionRangeConverter))>]
type SelectionRange = class
Public NotInheritable Class SelectionRange
상속
SelectionRange
특성

예제

다음 예제에서는 SelectionRange 의 속성을 MonthCalendar 컨트롤에 입력 된 두 개의 날짜에 따라 TextBox 시기를 제어를 Button 를 클릭 합니다. 이 코드의 새 인스턴스를 가정를 MonthCalendar 컨트롤을 두 TextBox 컨트롤 및 Button 만들어져는 Form합니다. 유효성을 검사 하는 코드를 추가 하는 것이 좋습니다는 Text 유효한 날짜가 포함 되어 있는지 확인 하려면 텍스트 상자에 할당 합니다.

private:
   void button1_Click( Object^ sender, EventArgs^ e )
   {
      // Set the SelectionRange with start and end dates from text boxes.
      try
      {
         monthCalendar1->SelectionRange = gcnew SelectionRange(
            DateTime::Parse( textBox1->Text ),
            DateTime::Parse( textBox2->Text ) );
      }
      catch ( Exception^ ex ) 
      {
         MessageBox::Show( ex->Message );
      }
   }
private void button1_Click(object sender,
                           EventArgs e)
{
   // Set the SelectionRange with start and end dates from text boxes.
   try
   {
      monthCalendar1.SelectionRange = new SelectionRange(
        DateTime.Parse(textBox1.Text),
        DateTime.Parse(textBox2.Text));
   }
   catch(Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}
Private Sub button1_Click(sender As Object, e As EventArgs)
   ' Set the SelectionRange with start and end dates from text boxes.
   Try
      monthCalendar1.SelectionRange = New SelectionRange( _
        DateTime.Parse(textBox1.Text), _
        DateTime.Parse(textBox2.Text))
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try
End Sub

설명

SelectionRange 는 날짜 또는 날짜를 선택 하 고 강조 표시는 MonthCalendar 제어 합니다. 하나의 날짜를 선택 하는 경우에 합니다 StartEnd 속성 값이 같습니다. SelectionRange 원하는 날짜에서 마우스 포인터를 끄는 동안 날짜를 클릭 하 여 변경할 수 있습니다 하거나 코드에서 범위를 설정할 수 있습니다. 두 개의 날짜 범위를 입력 하려는 하는 예를 들어 TextBox 컨트롤 또는 두 개의 DateTimePicker 컨트롤 집합과 SelectionRange 해당 날짜를 기반으로 합니다.

생성자

SelectionRange()

SelectionRange 클래스의 새 인스턴스를 초기화합니다.

SelectionRange(DateTime, DateTime)

지정된 시작 및 끝 날짜를 사용하여 SelectionRange의 새 인스턴스를 초기화합니다.

SelectionRange(SelectionRange)

지정된 선택 범위로 SelectionRange 클래스의 새 인스턴스를 초기화합니다.

속성

End

선택 영역 범위의 끝 날짜 및 시간을 가져오거나 설정합니다.

Start

선택 영역 범위의 시작 날짜 및 시간을 가져오거나 설정합니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

SelectionRange를 나타내는 문자열을 반환합니다.

적용 대상

추가 정보