void cell_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Right) { tsmSetRowsInColumn.Visible = true; m_contextCell = sender as Xceed.Grid.DataCell; contextMenuStrip1.Show(m_contextCell.PointToScreen(new System.Drawing.Point(e.X, e.Y))); m_contextSelector = null; } }
void RowSelector_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { tsmSetRowsInColumn.Visible = false; m_contextSelector = sender as Xceed.Grid.RowSelector; contextMenuStrip1.Show(m_contextSelector.PointToScreen(new System.Drawing.Point(e.X, e.Y))); m_contextCell = null; } }
void tsmCopy_Click(object sender, EventArgs e) { if (m_contextCell != null) { CopySelectedCellsToClipboard(m_contextCell); m_contextCell = null; } else if (m_contextSelector != null) { CopySelectedRowsToClipboard(m_contextSelector.Row); m_contextSelector = null; } }
void tsmAddNew_Click(object sender, System.EventArgs e) { if (m_contextCell != null) { this.DataRows.AddNew().EndEdit(); m_contextCell = null; } else if (m_contextSelector != null) { this.DataRows.AddNew().EndEdit(); m_contextSelector = null; } }
void tsmCut_Click(object sender, EventArgs e) { if (m_contextCell != null) { CopySelectedCellsToClipboard(m_contextCell); ClearSelectedCells(m_contextCell); m_contextCell = null; } else if (m_contextSelector != null) { IList <Xceed.Grid.Row> rowList = CopySelectedRowsToClipboard(m_contextSelector.Row); DeleteRows(rowList); m_contextSelector = null; } }
void tsmDelete_Click(object sender, EventArgs e) { if (m_contextCell != null) { m_contextCell.Value = null; m_contextCell = null; } else if (m_contextSelector != null) { IList <Xceed.Grid.Row> rowList = GetSelectedRowsToOperation(m_contextSelector.Row); DeleteRows(rowList); m_contextSelector = null; } }
void tsmInsert_Click(object sender, EventArgs e) { int currentRowIdx = -1; if (m_contextCell != null) { currentRowIdx = (m_contextCell.ParentRow as Xceed.Grid.DataRow).Index; m_contextCell = null; } else if (m_contextSelector != null) { currentRowIdx = (m_contextSelector.Row as Xceed.Grid.DataRow).Index; m_contextSelector = null; } if (currentRowIdx != -1) { int lastRow = this.FindLastEditRow(); if (lastRow >= currentRowIdx) { if (lastRow == this.DataRows.Count - 1) { this.DataRows.AddNew().EndEdit(); } for (int i = lastRow; i >= currentRowIdx; --i) { for (int j = 0; j < this.Columns.Count; ++j) { this.DataRows[i + 1].Cells[j].Value = this.DataRows[i].Cells[j].Value; } } for (int j = 0; j < this.Columns.Count; ++j) { this.DataRows[currentRowIdx].Cells[j].Value = null; } } } }
void tsmDelete_Click(object sender, EventArgs e) { if (m_contextCell != null) { m_contextCell.Value = null; m_contextCell = null; } else if (m_contextSelector != null) { IList<Xceed.Grid.Row> rowList = GetSelectedRowsToOperation(m_contextSelector.Row); DeleteRows(rowList); m_contextSelector = null; } }
void tsmCut_Click(object sender, EventArgs e) { if (m_contextCell != null) { CopySelectedCellsToClipboard(m_contextCell); ClearSelectedCells(m_contextCell); m_contextCell = null; } else if (m_contextSelector != null) { IList<Xceed.Grid.Row> rowList = CopySelectedRowsToClipboard(m_contextSelector.Row); DeleteRows(rowList); m_contextSelector = null; } }