DateTimePickerFormat 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
DateTimePicker 컨트롤이 표시하는 날짜 및 시간 형식을 지정합니다.
public enum class DateTimePickerFormat
public enum DateTimePickerFormat
type DateTimePickerFormat =
Public Enum DateTimePickerFormat
- 상속
필드
| Name | 값 | Description |
|---|---|---|
| Long | 1 | 컨트롤은 DateTimePicker 사용자의 운영 체제에서 설정한 긴 날짜 형식으로 날짜/시간 값을 표시합니다. |
| Short | 2 | 컨트롤은 DateTimePicker 사용자의 운영 체제에서 설정한 짧은 날짜 형식으로 날짜/시간 값을 표시합니다. |
| Time | 4 | 컨트롤은 DateTimePicker 사용자의 운영 체제에서 설정한 시간 형식으로 날짜/시간 값을 표시합니다. |
| Custom | 8 | 컨트롤은 DateTimePicker 날짜/시간 값을 사용자 지정 형식으로 표시합니다. 자세한 내용은 CustomFormat를 참조하세요. |
예제
다음 코드 예제에서는 값을 설정하여 개체를 DateTimePickerFormat 초기화하는 방법을 DateTimePickerFormat 보여 줍니다. 이 예제를 실행하려면 폼에 다음 코드를 붙여넣고 폼의 생성자 또는 InitializeDateTimePicker 이벤트 처리 메서드에서 호출 Load 합니다.
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
설명
이 열거형은 다음과 같은 DateTimePicker.Format멤버에서 사용됩니다.
메모
실제 날짜/시간 형식은 사용자의 운영 체제에 설정된 날짜, 시간 및 국가별 설정에 따라 결정됩니다.