Made a datagridview drag drop inside, there was a problem, for example: you need to drag the last line to the first place, while the first place is under the scrolling, how to do that when the mouse cursor gets closer to the top \ bottom of the datagridview, scrolling starts automatically up or down depending from the direction of dragging an item?

  • You can try this: use DataGridView.CellMouseEnter - occurs when you hover the mouse over a cell. We know how many rows fit in the visible part of the table. At the time of dragging the string, we will know and what cell we are now. If at the moment the mouse is pressed, and the index of the row selected and induced has a difference equal to the number of displayed rows minus one - change the dataGridView.CurrentCell property, depending on whether you get a positive or negative number - change it up or down. - Denis Bubnov
  • Or using dataGridView.FirstDisplayedScrollingRowIndex instead of dataGridView.CurrentCell implement this functionality - Denis Bubnov
  • @DenisBubnov tried with dataGridView.FirstDisplayedScrollingRowIndex , hung it on Mouse Move , Did so if the index of that under the arm and FirstDisplayedScrollingRowIndex are equal to each other then FirstDisplayedScrollingRowIndex +1. But it works like that then it does not work then the timeline on which the mouse incorrectly counts = (. I will try with CurrentCell . - Winteriscoming
  • there you just need to implement the correct logic in order not to go beyond the limits of the range, and at a certain moment to subtract one, and not add. Continue to use FirstDisplayedScrollingRowIndex - Denis Bubnov Sept
  • I did this if the index of the fact that under the mouse and FirstDisplayedScrollingRowIndex are equal to each other, FirstDisplayedScrollingRowIndex +1 is correct. And the second case is when (FirstDisplayedScrollingRowIndex + the number of visible rows ) = (index of that under the arm) - in this case FirstDisplayedScrollingRowIndex - 1 - Denis Bubnov

0