Cell selection in continuously updated DataGridView
I have a DataGridView in virtual mode that gets continuously updated by inserting rows at the top of the grid, so that rows appear to "flow down".
- When the grid is not updated, cell selection behaviour is as expected: mouse drag selection results in contiguous rectangular selection region.
- When the grid gets continuous updates, the selection region gets broken up into multiple ones and becomes discontinuous. The effect as if I'm "painting" the selection with a mouse on the grid.
How would I keep the behaviour #1 when the grid gets updated while selecting cells?
P. S.
I suppress the scrolling if the top row is out of the view (i开发者_Go百科.e. scrolling down a few rows) by incrementing DataGridView.FirstDisplayedScrollingRowIndex
each time a new row arrives.
I would try to pinpoint the starting point of the selection and in the CellEnter event ensure only cells filling the rectangle defined by the starting point and the current cell are selected.
精彩评论