Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DatePickerDateTextBox"/> class.
        /// </summary>
        /// <param name="picker">The parent <see cref="DatePicker"/> control.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="picker"/> is <c>null</c>.</exception>
        public DatePickerDateTextBox(DatePicker picker)
        {
            if (picker == null)
            {
                throw new ArgumentNullException("picker", "parameter 'picker' cannot be null.");
            }

            this.datePicker = picker;

            this.SetStyle(
                ControlStyles.AllPaintingInWmPaint
                | ControlStyles.OptimizedDoubleBuffer
                | ControlStyles.Selectable
                | ControlStyles.Opaque
                | ControlStyles.ResizeRedraw
                | ControlStyles.UserPaint,
                true);

            this.currentDate          = DateTime.Today;
            this.invalidDateBackColor = Color.Red;
            this.invalidDateForeColor = this.ForeColor;

            this.inputBox = new InputDateTextBox(this)
            {
                Visible          = false,
                Multiline        = true,
                ShortcutsEnabled = false
            };

            this.inputBox.FinishedEditing += this.InputBoxFinishedEditing;

            this.Controls.Add(this.inputBox);
        }
Ejemplo n.º 2
0
      /// <summary>
      /// Initializes a new instance of the <see cref="DatePickerDateTextBox"/> class.
      /// </summary>
      /// <param name="picker">The parent <see cref="DatePicker"/> control.</param>
      /// <exception cref="ArgumentNullException">If <paramref name="picker"/> is <c>null</c>.</exception>
      public DatePickerDateTextBox(DatePicker picker)
      {
         if (picker == null)
         {
            throw new ArgumentNullException("picker", "parameter 'picker' cannot be null.");
         }

         this.datePicker = picker;

         this.SetStyle(
            ControlStyles.AllPaintingInWmPaint
            | ControlStyles.OptimizedDoubleBuffer
            | ControlStyles.Selectable
            | ControlStyles.Opaque
            | ControlStyles.ResizeRedraw
            | ControlStyles.UserPaint,
            true);

         this.currentDate = DateTime.Today;
         this.invalidDateBackColor = Color.Red;
         this.invalidDateForeColor = this.ForeColor;

         this.inputBox = new InputDateTextBox(this)
         {
            Visible = false,
            Multiline = true,
            ShortcutsEnabled = false
         };

         this.inputBox.FinishedEditing += this.InputBoxFinishedEditing;

         this.Controls.Add(this.inputBox);
      }