GoPalette exception when scrolling

GoDiagram 2.5.2, Windows XP SP2, DoNet 1.1

Please do the following to reproduce the error:
1. Start the ProtoApp.exe in the Samples directory installed with GoDiagram 2.5.2
2. Make the main window a little shorter so that the vertical scroll bar of the GoPalette is visible and the scroll thumb button is relatively small so that it has a longer travelling range.
3. Make the main window as wide as possible so that later the vertical splitter bar can travel a long distance.
4. Drag the scroll thumb button of the GoPalette to the bottom.
5. Drag the vertical splitter bar to right as fas as possible. After this, you should see a blank GoPalette window.
6. Drag the scroll thumb button upwards or click the the upwards button of the vertical scrollbar in the GoPalette, you may get an exception.
7. If you cannot get first time, try again.
After this error, the program exits. In my own program, this error happens almost every time for sure.
The exception is from System.Drawing.dll, so it seems GoPalette tries to set a scroll value for the vertical scroll bar beyond the scroll range.

I can reproduce the problem.

But there's just one place where our code sets the Value property for the vertical scroll bar (and one place for the horizontal scroll bar), and it's not our code that is causing the exception.
So this might be a bug in Windows Forms. At least it appears hard to track down, since the stack seems useless. I'll investigate some more.

I guess it’s because the scroll range of the vertical scroll bar is not synchronized with the Document size of GoPalette.

After the vertical splitter bar is moved to right, the GoPalette will show a blank white area and the GoObjects are hidden on the top, and the vertical scrollbar is still visible even at this momnet the Document height is short enough to hide the vertical scrollbar and all the GoObjects should be visible.

Yes, GoView doesn’t automatically change the GoView.DocPosition just to accomodate changes in the view’s size. You can just set:

goView1.DocPosition = goView1.LimitDocPosition(goView1.DocPosition)
to make sure the view is scrolled to its normal values.