I’ve got a custom control derived from System.Windows.Forms.UserControl, which paints itself in an overridden OnPaint proc and also has a varying number of other controls sitting on top. Depending on user input this custom control might grow larger than can be displayed in its parent form.

I set AutoScroll=True and VerticalScroll.Visible = True for the custom control to enable scrolling. This works as expected.

However, after any other window got the focus and then the focus is reset to my form with the custom control again, the control will automatically scroll to the very top of the scrollbar. – This is very annoying as users needs to reposition the scroll bar to where they were before.

How can I prevent AutoScroll from jumping to the top when the form gets the focus?

(PS: Target Framework is still .NET Framework 2.0.)