Hello,
I had also some concerns about the ScrollBar.Maximum and ScrollBar.LargeChange problem.
In some cases ScrollBar.Maximum had to be ScrollBar.Maximum = MaxValue
In an other case ScrollBar.Maximum = MaxValue - ScrollBar.LargeChange + 1
So I had a closer look at the ScrollBar.Maximum and ScrollBar.LargeChange problem.
It is somewhat more complicated and depends on the length of the displayed part of the 'document' and the LargeChange value.
I have written a small program to illustrate the relationships.
In the upper part I only put a ScrollBar with Min = 0 Max = 100 ScrollBar.LargeChange = 20
In this case ScrollBar.Maximum = 100 !
If you slide the cursor to the maximum the ScrollBar.Value becomes Max - ScrollBar.LargeChange + 1 = 81
In the middle part with a ruler bitmap display, width bmpW = 1201 pixel. In this case the ScrollBar.LargeChange is allways equal to the width of the displayed screen. And ScrollBar.Maximum = MaxValue = 1200
1201 is the number of pixels, 1200 is the last pixel position counting from 0 ! ! !
In the lower part, the screen display is GraphW = 200 pixels wide, the ScrollBar.LargeChange = 100, this is half of the display width.
In that case, ScrollBar.Maximum = 1201 - ScrollBar.LargeChange = 1101
or ScrollBar.Maximum = 1200 - ScrollBar.LargeChange +1 = 1101
Once again, 1201 is the number of pixels, 1200 is the last pixel position counting from 0 ! ! !
If we put ScrollBar.LargeChange = 50, and slide the cursor at the end, the displayed ruler is wrong !
The ScrollBar.Maximum value, in this case, must be: (check the CheckBox)
ScrollBar.Maximum = bmpW - 1 - GraphW + ScrollBar.LargeChange
this is the general case if ScrollBar.LargeChange < GraphW. For, if ScrollBar.LargeChange = GraphW then ScrollBar.Maximum = bmpW - 1 ? !
In all cases, in the lower part, the maximum value of the ScrollBar.Value = 1001, this is the max value - display width, or bmpW - GraphW = 1201 - 200 = 1001.
For me there is a strange behaviour, because in my mind, as it is in Visual Basic, ScrollBar.Maximum should be the max value for ScrollBar.Value.
In the example in the middle part, if you enter ScrollBar.Value = 1150, which is higher than the max value of 1101 when sliding the cursor to the right end, it is accepted but the display is wrong. If you enter ScrollBar.Value = 1201 which is higher than ScrollBar.Maximum, an error is generated.
Erel, is this different behaviour in B4PPC, according to VB, due to .NET or due to B4PPC ?
I hope my post is understandable.
Best regards.