I found this answer in Microsoft Forum
"To drag multiple rows, set DataGridView.MultiSelect to true and to the DataGridView.DragDrop event, delete and paste all rows in the DataGridView.SelectedRows collection."
This blog post also shows how to implement drag and drop on a DataGridView.
But it seems to me that you will have to inherit from the DataGridView and override these mouse events, as changing the selection will always be called differently.
- protected virtual void OnCellMouseDown (DataGridViewCellMouseEventArgs e);
- protected virtual void OnCellMouseUp (DataGridViewCellMouseEventArgs e);
Then you can catch the SelectionChanged event in OnMouseDown and make a selection in OnMouseUp. You will need to leave the point down so that you can select the correct item if it was not a drag.
You will also need to save the list of selected rows in the mouse event, and if it turns into a drag and drop event, you drag all these selected rows and select them with the mouse.
And don't forget to clear the list / copy of the selected lines in the mouse event.
user18443
source share