I have a FlowLayoutPanel with AutoScroll set to true. It has a TopDown flow, alternating between a custom control which I will refer to as a “header�and then a DataGridView below each header. There can be any number of these control pairs within any given FlowLayoutPanel. As the individual DataGridViews get long, or as the number of controls within the FlowLayoutPanel get too long for the screen, a vertical scrollbar automatically appears, as would be expected.
The problem that I am having is that making a row selection within a DataGridView can cause that DataGridView to abruptly scroll to the top or bottom of the scrollable window of the FlowLayoutPanel. If the DGV isn’t entirely visible towards the top, it scrolls downwards until it is. Likewise, if the DGV isn’t entirely visible on the bottom, it scrolls upwards until it is. Although I expect this is an intended consequence of selecting a control within an auto-scrolling container, this is rather disconcerting to my users. They can see the rows they want to select quite well, and don’t care if they don’t see all the others within the same DGV. I would like to suppress this functionality, but can’t figure out how.
I was really hoping for a cancellable event for which I could write a handler and set e.Cancel to true. I can’t find such an event. Nor can I find any ScrollableControl properties which can combine to give me this effect. Any advice you can offer would be greatly appreciated.