DateTimePicker.ShowUpDown Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau menetapkan nilai yang menunjukkan apakah kontrol tombol putar (juga dikenal sebagai kontrol up-down) digunakan untuk menyesuaikan nilai tanggal/waktu.
public:
property bool ShowUpDown { bool get(); void set(bool value); };
public bool ShowUpDown { get; set; }
member this.ShowUpDown : bool with get, set
Public Property ShowUpDown As Boolean
Nilai Properti
true jika kontrol tombol putar digunakan untuk menyesuaikan nilai tanggal/waktu; jika tidak, false. Defaultnya adalah false.
Contoh
Contoh kode berikut membuat instans DateTimePicker baru kontrol dan menginisialisasinya. Properti kontrol CustomFormat diatur. Selain itu ShowCheckBox , properti diatur sehingga kontrol menampilkan CheckBox, dan ShowUpDown properti diatur sehingga kontrol ditampilkan sebagai kontrol tombol putar.
public:
void CreateMyDateTimePicker()
{
// Create a new DateTimePicker control and initialize it.
DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker;
// Set the MinDate and MaxDate.
dateTimePicker1->MinDate = DateTime(1985,6,20);
dateTimePicker1->MaxDate = DateTime::Today;
// Set the CustomFormat string.
dateTimePicker1->CustomFormat = "MMMM dd, yyyy - dddd";
dateTimePicker1->Format = DateTimePickerFormat::Custom;
// Show the CheckBox and display the control as an up-down control.
dateTimePicker1->ShowCheckBox = true;
dateTimePicker1->ShowUpDown = true;
}
public void CreateMyDateTimePicker()
{
// Create a new DateTimePicker control and initialize it.
DateTimePicker dateTimePicker1 = new DateTimePicker();
// Set the MinDate and MaxDate.
dateTimePicker1.MinDate = new DateTime(1985, 6, 20);
dateTimePicker1.MaxDate = DateTime.Today;
// Set the CustomFormat string.
dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd";
dateTimePicker1.Format = DateTimePickerFormat.Custom;
// Show the CheckBox and display the control as an up-down control.
dateTimePicker1.ShowCheckBox = true;
dateTimePicker1.ShowUpDown = true;
}
Public Sub CreateMyDateTimePicker()
' Create a new DateTimePicker control and initialize it.
Dim dateTimePicker1 As New DateTimePicker()
' Set the MinDate and MaxDate.
dateTimePicker1.MinDate = New DateTime(1985, 6, 20)
dateTimePicker1.MaxDate = DateTime.Today
' Set the CustomFormat string.
dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd"
dateTimePicker1.Format = DateTimePickerFormat.Custom
' Show the CheckBox and display the control as an up-down control.
dateTimePicker1.ShowCheckBox = True
dateTimePicker1.ShowUpDown = True
End Sub
Keterangan
ShowUpDown Saat properti diatur ke true, kontrol tombol putar (juga dikenal sebagai kontrol naik turun), bukan kalender drop-down, digunakan untuk menyesuaikan nilai waktu. Tanggal dan waktu dapat disesuaikan dengan memilih setiap elemen satu per satu dan menggunakan tombol atas dan bawah untuk mengubah nilai.
Untuk menampilkan hanya waktu dalam DateTimePicker, atur Format properti ke Time, dan ShowUpDown properti ke true.