예제 #1
0
        // Event relay - double click on a cell
        public void CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
            {
                var val = _theDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex];
                var tag = _theDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag;

                if (tag is CCell)
                {
                    CCellMatrix theMatrix = BuildMatrixFromGrid();

                    CCell theCurrentCell = (CCell)tag;

                    using (var modal = new FormDialogCCel(theCurrentCell, theMatrix))
                    {
                        modal.ShowDialog();
                        if (modal.DialogResult == DialogResult.OK)
                        {
                            // refresh grid
                            ClearGrid();
                            AddHeaderToGrid();
                            AddDataToGrid();
                        }
                    }
                }
            }
        }
예제 #2
0
        private void dataGridViewDyn_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
            {
                var val = dataGridViewDyn.Rows[e.RowIndex].Cells[e.ColumnIndex];
                var tag = dataGridViewDyn.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag;

                if (tag is CCell)
                {
                    // CCellHeader tCellHeader = new CCellHeader();

                    CCellMatrix theMatrix = BuildMatrixFromGrid(dataGridViewDyn);


                    using (var modal = new FormDialogCCel((CCell)tag, theMatrix))
                    {
                        modal.ShowDialog();
                        if (modal.DialogResult == DialogResult.OK)
                        {
                            // _cellHeaderVector.AddCellHeader(tCellHeader);

                            // AddCellToGrid(dataGridViewDyn, _cellHeaderVector);

                            // refresh grid
                            this.dataGridViewDyn.Columns.Clear();
                            AddCellToGrid(this.dataGridViewDyn, _theMatrix._cellHeaderVector);
                            AddDataToGrid(this.dataGridViewDyn, _theMatrix);
                        }
                        else if (modal.DialogResult == DialogResult.Cancel)
                        {
                        }
                    }
                }
            }
        }