You can try capturing the mouse down, move and up events and handling the selection yourself. This works for dragging from top to bottom, additional logic needs to be added to drag the other direction, but that should doable for you.
{
dataGridView1.CellMouseDown += dataGridView1_CellMouseDown;
dataGridView1.CellMouseMove += dataGridView1_CellMouseMove;
dataGridView1.CellMouseUp += dataGridView1_CellMouseUp;
dataGridView1.SelectionMode = DataGridViewSelectionMode.CellSelect;
}
int startRow;
int startColumn;
bool beginSelection;
void dataGridView1_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
{
beginSelection = false;
}
void dataGridView1_CellMouseMove(object sender, DataGridViewCellMouseEventArgs e)
{
if (!beginSelection)
return;
dataGridView1.ClearSelection();
int curRow = e.RowIndex;
int curCol = e.ColumnIndex;
for (int r = startRow; r <= curRow; r++)
{
int maxC = dataGridView1.ColumnCount-1;
int minC = 0;
if (r == curRow)
maxC = curCol;
if (r == startRow)
minC = startColumn;
for (int c = minC; c <= maxC; c++)
{
dataGridView1[c,r].Selected = true;
}
}
}
void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
beginSelection = true;
startRow = e.RowIndex;
startColumn = e.ColumnIndex;
}