示例#1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="domain"></param>
        /// <param name="maxLength"></param>
        public void SetStdControlDomain(int colIdx, ZControlDomain domain, int maxLength)
        {
            if (!ColumnControlDomain.ContainsKey(colIdx))
            {
                ColumnControlDomain.Add(colIdx, domain);
            }
            else
            {
                ColumnControlDomain[colIdx] = domain;
            }

            if (!ColumnLengthMap.ContainsKey(colIdx))
            {
                ColumnLengthMap.Add(colIdx, maxLength);
            }
            else
            {
                ColumnLengthMap[colIdx] = maxLength;
            }

            SetControlProperty(colIdx);
        }
示例#2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="colIdx"></param>
        /// <param name="domain"></param>
        /// <returns></returns>
        protected DataGridViewEditingControlShowingEventHandler CreateStdEditorHandler(int colIdx, ZControlDomain domain)
        {
            #region 個別パラメータ宣言

            int maxLength = int.MaxValue;
            ImeMode imeMode = System.Windows.Forms.ImeMode.On;

            #endregion

            DataGridViewEditingControlShowingEventHandler stdEvent;
            stdEvent = delegate(object sender, DataGridViewEditingControlShowingEventArgs e)
            {
                // カラムインデックスチェック
                DataGridView dgv = (DataGridView)sender;
                if (dgv.CurrentCell.OwningColumn.Index != colIdx)
                {
                    return;
                }

                // TODO イベントハンドラを追加する場合は、2重登録防止を考慮する

                if (e.Control is DataGridViewTextBoxEditingControl)
                {
                    (e.Control as DataGridViewTextBoxEditingControl).MaxLength = maxLength;
                    (e.Control as DataGridViewTextBoxEditingControl).ImeMode = imeMode;
                }
                else if (e.Control is DataGridViewComboBoxEditingControl)
                {
                    (e.Control as DataGridViewComboBoxEditingControl).MaxLength = maxLength;
                    (e.Control as DataGridViewComboBoxEditingControl).ImeMode = imeMode;

                    // TODO これは必要か検討する(多分不要)
                    //(e.Control as DataGridViewComboBoxEditingControl).DropDownStyle = ComboBoxStyle.DropDownList;
                }
            };

            #region カラム毎、個別イベントパラメータ設定

            if (domain == ZControlDomain.NONE)
            {
                // NONE
            }
            else if (domain == ZControlDomain.ZG_STD_NAME)
            {
                maxLength = ColumnLengthMap[colIdx];
                imeMode = ImeMode.Hiragana;
            }
            else if (domain == ZControlDomain.ZG_STD_CD)
            {
                maxLength = ColumnLengthMap[colIdx];
                imeMode = ImeMode.Off;
            }
            else if (domain == ZControlDomain.ZG_STD_NUM)
            {
                maxLength = ColumnLengthMap[colIdx];
                imeMode = ImeMode.Off;
            }
            else if (domain == ZControlDomain.ZG_TEL_NO)
            {
                maxLength = 13;
                imeMode = ImeMode.Off;
            }
            else if (domain == ZControlDomain.ZG_ZIP_CD)
            {
                maxLength = 8;
                imeMode = ImeMode.Off;
            }

            #endregion

            return stdEvent;
        }
示例#3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="colIdx"></param>
        /// <param name="domain"></param>
        public void SetControlDomain(int colIdx, ZControlDomain domain)
        {
            if (!ColumnControlDomain.ContainsKey(colIdx))
            {
                ColumnControlDomain.Add(colIdx, domain);
            }
            else
            {
                ColumnControlDomain[colIdx] = domain;
            }

            SetControlProperty(colIdx);
        }