Пример #1
0
        public virtual void showCustomCtrl(int col, int row)
        {
            Debug.WriteLine("showDtp");

            //fix error control not hide
            if (m_customCtrl != null)
            {
                Debug.Assert(false, "previous ctrl should be disposed");
                m_customCtrl.Dispose();
                m_customCtrl = null;
                return;
            }

            if (m_tblInfo.m_cols[col].m_type == lTableInfo.lColInfo.lColType.dateTime)
            {
                m_customCtrl = new myDateTimePicker(this);
            }
            else if (m_tblInfo.m_cols[col].m_lookupData != null)
            {
                m_customCtrl = new myComboBox(this, m_tblInfo.m_cols[col].m_lookupData);
            }
            if (m_customCtrl != null)
            {
                m_customCtrl.m_iRow = row;
                m_customCtrl.m_iCol = col;
                this.Controls.Add(m_customCtrl.getControl());
                if (CurrentCell.Value != null)
                {
                    m_customCtrl.setValue(this.CurrentCell.Value.ToString());
                }
                Rectangle rec = this.GetCellDisplayRectangle(col, row, true);
                m_customCtrl.show(rec);

                //ActiveControl = m_dtp;
                this.BeginEdit(true);
            }
        }
Пример #2
0
        private void showCustomCtrl(int col, int row)
        {
            Debug.WriteLine("showDtp");
            if (m_tblInfo.m_cols[col].m_type == lTableInfo.lColInfo.lColType.dateTime)
            {
                m_customCtrl = new myDateTimePicker(m_dataGridView);
            }
            else if (m_tblInfo.m_cols[col].m_lookupData != null)
            {
                m_customCtrl = new myComboBox(m_dataGridView, m_tblInfo.m_cols[col].m_lookupData.m_dataSource);
            }
            if (m_customCtrl != null)
            {
                m_customCtrl.m_iRow = row;
                m_customCtrl.m_iCol = col;
                m_dataGridView.Controls.Add(m_customCtrl.getControl());
                m_customCtrl.setValue(m_dataGridView.CurrentCell.Value.ToString());
                Rectangle rec = m_dataGridView.GetCellDisplayRectangle(col, row, true);
                m_customCtrl.show(rec);

                //ActiveControl = m_dtp;
                m_dataGridView.BeginEdit(true);
            }
        }