DateTimePicker.DropDownAlign DateTimePicker.DropDownAlign DateTimePicker.DropDownAlign DateTimePicker.DropDownAlign Property

정의

DateTimePicker 컨트롤에서 드롭다운 달력의 맞춤을 가져오거나 설정합니다.Gets or sets the alignment of the drop-down calendar on the DateTimePicker control.

public:
 property System::Windows::Forms::LeftRightAlignment DropDownAlign { System::Windows::Forms::LeftRightAlignment get(); void set(System::Windows::Forms::LeftRightAlignment value); };
public System.Windows.Forms.LeftRightAlignment DropDownAlign { get; set; }
member this.DropDownAlign : System.Windows.Forms.LeftRightAlignment with get, set
Public Property DropDownAlign As LeftRightAlignment

속성 값

컨트롤에 있는 드롭다운 달력의 맞춤입니다.The alignment of the drop-down calendar on the control. 기본값은 Left입니다.The default is Left.

예외

할당 된 값 중 하나가 아닙니다는 LeftRightAlignment 값입니다.The value assigned is not one of the LeftRightAlignment values.

예제

다음 코드 예제에서는 초기화를 DateTimePicker 설정 하 여는 DropDownAlign, Value, Format, 및 CustomFormat 속성.The following code example demonstrates initializing a DateTimePicker by setting the DropDownAlign, Value, Format, and CustomFormat properties. 이 예제를 실행 하려면 호출을 폼에 다음 코드를 붙여 넣습니다 InitializeDateTimePicker 폼의 생성자에서 또는 Load 이벤트 처리 메서드.To run this example, paste the following code into a form and call InitializeDateTimePicker from the form's constructor or Load event-handling method.

internal:
   // Declare the DateTimePicker.
   System::Windows::Forms::DateTimePicker^ DateTimePicker1;

private:
   void InitializeDateTimePicker()
   {
      // Construct the DateTimePicker.
      this->DateTimePicker1 = gcnew System::Windows::Forms::DateTimePicker;
      
      //Set size and location.
      this->DateTimePicker1->Location = System::Drawing::Point( 40, 88 );
      this->DateTimePicker1->Size = System::Drawing::Size( 160, 21 );
      
      // Set the alignment of the drop-down MonthCalendar to right.
      this->DateTimePicker1->DropDownAlign = LeftRightAlignment::Right;
      
      // Set the Value property to 50 years before today.
      DateTimePicker1->Value = System::DateTime::Now.AddYears(  -50 );
      
      //Set a custom format containing the string "of the year"
      DateTimePicker1->Format = DateTimePickerFormat::Custom;
      DateTimePicker1->CustomFormat = "MMM dd, 'of the year' yyyy ";
      
      // Add the DateTimePicker to the form.
      this->Controls->Add( this->DateTimePicker1 );
   }

// Declare the DateTimePicker.
internal System.Windows.Forms.DateTimePicker DateTimePicker1;


private void InitializeDateTimePicker()
{
	// Construct the DateTimePicker.
	this.DateTimePicker1 = new System.Windows.Forms.DateTimePicker();

	//Set size and location.
	this.DateTimePicker1.Location = new System.Drawing.Point(40, 88);
	this.DateTimePicker1.Size = new System.Drawing.Size(160, 21);
       
	// Set the alignment of the drop-down MonthCalendar to right.
	this.DateTimePicker1.DropDownAlign = LeftRightAlignment.Right;

	// Set the Value property to 50 years before today.
	DateTimePicker1.Value = System.DateTime.Now.AddYears(-50);

	//Set a custom format containing the string "of the year"
	DateTimePicker1.Format = DateTimePickerFormat.Custom;
	DateTimePicker1.CustomFormat = "MMM dd, 'of the year' yyyy ";

	// Add the DateTimePicker to the form.
	this.Controls.Add(this.DateTimePicker1);
}

' Declare the DateTimePicker.
Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker


Private Sub InitializeDateTimePicker()

    ' Construct the DateTimePicker.
    Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker

    'Set size and location.
    Me.DateTimePicker1.Location = New System.Drawing.Point(40, 88)
    Me.DateTimePicker1.Size = New Size(160, 21)
    
    ' Set the alignment of the drop-down MonthCalendar to right.
    Me.DateTimePicker1.DropDownAlign = LeftRightAlignment.Right

    ' Set the Value property to 50 years before today.
    DateTimePicker1.Value = (DateTime.Now.AddYears(-50))

    'Set a custom format containing the string "of the year"
    DateTimePicker1.Format = DateTimePickerFormat.Custom
    DateTimePicker1.CustomFormat = "MMM dd, 'of the year' yyyy "

    ' Add the DateTimePicker to the form.
    Me.Controls.Add(Me.DateTimePicker1)
End Sub

설명

컨트롤의 오른쪽 또는 왼쪽 드롭다운 달력을 정렬할 수 있습니다.The drop-down calendar can be aligned to the left or right of the control.

적용 대상

추가 정보