DateTimePicker.ShowCheckBox 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 mengatur nilai yang menunjukkan apakah kotak centang ditampilkan di sebelah kiri tanggal yang dipilih.
public:
property bool ShowCheckBox { bool get(); void set(bool value); };
public bool ShowCheckBox { get; set; }
member this.ShowCheckBox : bool with get, set
Public Property ShowCheckBox As Boolean
Nilai Properti
true jika kotak centang ditampilkan di sebelah kiri tanggal yang dipilih; 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 (juga dikenal sebagai kontrol naik turun).
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
ShowCheckBox Saat properti diatur ke true, kotak centang ditampilkan di sebelah kiri tanggal dalam kontrol. Saat kotak centang dipilih, nilai tanggal/waktu dapat diperbarui. Saat kotak centang dikosongkan, nilai tanggal/waktu tidak dapat diubah.