Inheritance: FADatePicker, IDataGridViewEditingControl
Esempio n. 1
0
        public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
        {
            base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
            DataGridViewFADateTimePickerEditor editor = Editor;

            if (editor != null)
            {
                var column = GetColumn();

                editor.RightToLeft = DataGridView.RightToLeft;
                editor.Theme       = column.Theme;

                var formattedValue = initialFormattedValue.ToString();

                if (string.IsNullOrEmpty(formattedValue))
                {
                    editor.SelectedDateTime = DateTime.Now;
                    editor.mv.MonthViewControl.SetNoneDay();
                }
                else
                {
                    editor.SelectedDateTime = GetParsedDate(formattedValue);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Determines whether this cell, at the given row index, shows the grid's editing control or not.
        /// The row index needs to be provided as a parameter because this cell may be shared among multiple rows.
        /// </summary>
        private bool OwnsEditor(int rowIndex)
        {
            if (rowIndex == -1 || DataGridView == null)
            {
                return(false);
            }

            DataGridViewFADateTimePickerEditor editor = Editor;

            return(editor != null && rowIndex == editor.EditingControlRowIndex);
        }