DateTimePickerFormat Enumeráció
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Megadja a vezérlő által megjelenített dátum- és időformátumot DateTimePicker .
public enum class DateTimePickerFormat
public enum DateTimePickerFormat
type DateTimePickerFormat =
Public Enum DateTimePickerFormat
- Öröklődés
Mezők
| Name | Érték | Description |
|---|---|---|
| Long | 1 | A DateTimePicker vezérlő a felhasználó operációs rendszere által beállított hosszú dátumformátumban jeleníti meg a dátum/idő értéket. |
| Short | 2 | A DateTimePicker vezérlő a felhasználó operációs rendszere által beállított rövid dátumformátumban jeleníti meg a dátum/idő értéket. |
| Time | 4 | A DateTimePicker vezérlő a felhasználó operációs rendszere által beállított időformátumban jeleníti meg a dátum/idő értéket. |
| Custom | 8 | A DateTimePicker vezérlő egyéni formátumban jeleníti meg a dátum/idő értéket. További információért lásd CustomFormat. |
Példák
Az alábbi példakód bemutatja, hogy egy DateTimePicker objektum inicializálása értékre Format van-e DateTimePickerFormat állítva. A példa futtatásához illessze be az alábbi kódot egy űrlapba, és hívja meg InitializeDateTimePicker az űrlap konstruktorát vagy Load eseménykezelési módszerét.
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
Megjegyzések
Ezt az enumerálást olyan tagok használják, mint a DateTimePicker.Format.
Note
A tényleges dátum-/időformátumokat a felhasználó operációs rendszerében beállított dátum, idő és területi beállítások határozzák meg.