コード例 #1
0
        /// <summary>
        /// Start editing the cell passed. Do not call this method for start editing a cell, you must use Cell.StartEdit.
        /// </summary>
        /// <param name="p_Cell">Cell to start edit</param>
        /// <param name="position">Editing position(Row/Col)</param>
        /// <param name="p_StartEditValue">Can be null(in this case use the p_cell.Value</param>
        public override void InternalStartEdit(Cells.ICellVirtual p_Cell, Position position, object p_StartEditValue)
        {
            base.InternalStartEdit(p_Cell, position, p_StartEditValue);

            if (EnableEdit == false)
            {
                return;
            }

            ComboBoxTyped l_Combo = GetEditorComboBox(p_Cell.Grid);

            l_Combo.Validator              = this;
            l_Combo.EnableEscapeKeyUndo    = false;
            l_Combo.EnableEnterKeyValidate = false;
            l_Combo.EnableLastValidValue   = false;
            l_Combo.EnableAutoValidation   = false;

            if (p_StartEditValue is string && IsStringConversionSupported())
            {
                l_Combo.TextBox.Text = TextBoxTyped.ValidateCharactersString((string)p_StartEditValue, l_Combo.TextBox.ValidCharacters, l_Combo.TextBox.InvalidCharacters);
                if (l_Combo.TextBox.Text != null)
                {
                    l_Combo.TextBox.SelectionStart = l_Combo.TextBox.Text.Length;
                }
                else
                {
                    l_Combo.TextBox.SelectionStart = 0;
                }
            }
            else
            {
                l_Combo.Value = p_Cell.GetValue(position);
                l_Combo.SelectAllTextBox();
            }
        }
コード例 #2
0
        public override Control CreateEditorControl()
        {
            TextBoxTyped l_Control = new TextBoxTyped();

            l_Control.BorderStyle = BorderStyle.None;
            l_Control.AutoSize    = false;
            return(l_Control);
        }
コード例 #3
0
        /// <summary>
        /// Start editing the cell passed. Do not call this method for start editing a cell, you must use Cell.StartEdit.
        /// </summary>
        /// <param name="p_Cell">Cell to start edit</param>
        /// <param name="position">Editing position(Row/Col)</param>
        /// <param name="p_StartEditValue">Can be null(in this case use the p_cell.Value</param>
        public override void InternalStartEdit(Cells.ICellVirtual p_Cell, Position position, object p_StartEditValue)
        {
            base.InternalStartEdit(p_Cell, position, p_StartEditValue);

            if (EnableEdit == false)
            {
                return;
            }

            TextBoxTyped l_TxtBox = GetEditorTextBox(p_Cell.Grid);

            l_TxtBox.Validator              = this;
            l_TxtBox.EnableEscapeKeyUndo    = false;
            l_TxtBox.EnableEnterKeyValidate = false;
            l_TxtBox.EnableLastValidValue   = false;
            l_TxtBox.EnableAutoValidation   = false;

            l_TxtBox.Multiline = isMultiLine;
            if (isMultiLine == false)
            {
                l_TxtBox.MaxLength = maximumLength;
            }

            l_TxtBox.WordWrap          = p_Cell.VisualModel.WordWrap;
            l_TxtBox.TextAlign         = AlignmentUtility.ContentToHorizontalAlignment(p_Cell.VisualModel.TextAlignment);
            l_TxtBox.Font              = p_Cell.VisualModel.Font;
            l_TxtBox.ValidCharacters   = validCharacters;
            l_TxtBox.InvalidCharacters = invalidCharacters;

            if (p_StartEditValue is string && IsStringConversionSupported())
            {
                l_TxtBox.Text           = TextBoxTyped.ValidateCharactersString((string)p_StartEditValue, validCharacters, invalidCharacters);
                l_TxtBox.SelectionStart = l_TxtBox.Text.Length;
            }
            else
            {
                l_TxtBox.Value = p_Cell.GetValue(position);
                l_TxtBox.SelectAll();
            }
        }