private void showCustomCtrl(int col, int row) { if (col == 3) { DataTable tbl = new DataTable(); string sql = "select content from receipts_content;"; SQLiteDataAdapter da = new SQLiteDataAdapter(sql, m_dbConnection); da.Fill(tbl); m_customCtrl = new myComboBox(dGV_receipt, tbl); } else if (col == 1) { m_customCtrl = new myDateTimePicker(dGV_receipt); } if (m_customCtrl != null) { m_customCtrl.m_iRow = row; m_customCtrl.m_iCol = col; dGV_receipt.Controls.Add(m_customCtrl.getControl()); m_customCtrl.setValue(dGV_receipt.CurrentCell.Value.ToString()); Rectangle rec = dGV_receipt.GetCellDisplayRectangle(col, row, true); m_customCtrl.show(rec); ActiveControl = m_customCtrl.getControl(); dGV_receipt.BeginEdit(true); } }
private void hideCustomCtrl() { if (m_customCtrl != null) { m_customCtrl.hide(); if (m_customCtrl.isChanged()) { dGV_receipt.CurrentCell.Value = m_customCtrl.getValue(); } dGV_receipt.Controls.Remove(m_customCtrl.getControl()); m_customCtrl = null; } }