private void DgviewCases_CellMouseMove(object sender, DataGridViewCellMouseEventArgs e) { if ((e.Button == MouseButtons.Left)) { if ((e.RowIndex > -1)) { DgviewCases.DoDragDrop(DgviewCases.Rows[e.RowIndex], DragDropEffects.Move); } } }
public void RemoveCase() { if (DgviewCases.SelectedRows != null && DgviewCases.SelectedRows.Count > 0) { foreach (var item in DgviewCases.SelectedRows) { var dgv = item as DataGridViewRow; DgviewCases.Rows.Remove(dgv); } DgviewCases.Refresh(); } }
private int GetRowFromPoint(int x, int y) { for (int i = 0; i < DgviewCases.RowCount; i++) { Rectangle rec = DgviewCases.GetRowDisplayRectangle(i, false); if (DgviewCases.RectangleToScreen(rec).Contains(x, y)) { return(i); } } return(-1); }