DateTimePicker.ShowCheckBox Propriété

Définition

Obtient ou définit une valeur indiquant si une case à cocher figure à gauche de la date sélectionnée.

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

Valeur de propriété

Boolean

true si une case à cocher figure à gauche de la date sélectionnée ; sinon, false. La valeur par défaut est false.

Exemples

L’exemple de code suivant crée une nouvelle instance d’un DateTimePicker contrôle et l’initialise. La propriété du CustomFormat contrôle est définie. En outre, la ShowCheckBox propriété est définie de sorte que le contrôle affiche un CheckBox, et ShowUpDown la propriété est définie afin que le contrôle soit affiché en tant que contrôle de bouton de rotation (également appelé contrôle up-down).

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

Remarques

Lorsque la ShowCheckBox propriété est définie sur , une case à truecocher s’affiche à gauche de la date dans le contrôle. Lorsque la case à cocher est activée, la valeur de date/heure peut être mise à jour. Lorsque la case à cocher est désactivée, la valeur date/heure ne peut pas être modifiée.

S’applique à