DateTimePickerFormat Enum
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee geeft u de datum- en tijdnotatie op die het DateTimePicker besturingselement weergeeft.
public enum class DateTimePickerFormat
public enum DateTimePickerFormat
type DateTimePickerFormat =
Public Enum DateTimePickerFormat
- Overname
Velden
| Name | Waarde | Description |
|---|---|---|
| Long | 1 | Het DateTimePicker besturingselement geeft de datum/tijd-waarde weer in de lange datumnotatie die is ingesteld door het besturingssysteem van de gebruiker. |
| Short | 2 | Het DateTimePicker besturingselement geeft de datum/tijd-waarde weer in de korte datumnotatie die is ingesteld door het besturingssysteem van de gebruiker. |
| Time | 4 | Het DateTimePicker besturingselement geeft de datum/tijd-waarde weer in de tijdnotatie die is ingesteld door het besturingssysteem van de gebruiker. |
| Custom | 8 | Het DateTimePicker besturingselement geeft de datum/tijd-waarde weer in een aangepaste notatie. Zie CustomFormat voor meer informatie. |
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u een DateTimePicker object initialiseert door de Format waarde in te stellen op een DateTimePickerFormat waarde. Als u dit voorbeeld wilt uitvoeren, plakt u de volgende code in een formulier en roept InitializeDateTimePicker u deze aan vanuit de constructor- of Load gebeurtenisafhandelingsmethode van het formulier.
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
Opmerkingen
Deze opsomming wordt gebruikt door leden zoals DateTimePicker.Format.
Note
De werkelijke datum-/tijdnotaties worden bepaald door de datum-, tijd- en landinstellingen die zijn ingesteld in het besturingssysteem van de gebruiker.