I am trying to use VBAccelerator Scrollbar class to scroll picture in picturebox. But I have a Max Thumb position Issue ,which either is related to my code or this scrollbar class.
For example:
My picturebox's ScaleWidth is 600 pixels,the picture has 1000 pixels width.
Code:
m_HVScroll.Visible(efsHorizontal) = True
m_HVScroll.Min(efsHorizontal) = 0
m_HVScroll.LargeChange(efsHorizontal) = 600 'equal to picture1.ScaleWidth
m_HVScroll.Max(efsHorizontal) = 1000-600 'Maximum available movement
m_HVScroll.SmallChange(efsHorizontal) = 10 'click button to move 10 pixels
If I fast move the Thumb, the debug window show the m_HVScroll.Value(efsHorizontal) = 401.
If I click the Right button, the Value change to 400, I can see the scrollbat stepping backward 1 pixel.
Those are not what I want. I need m_HVScroll.Value(efsHorizontal)= 400 at the end.
In Class, I saw tSI.nTrackPos = 401 (Note: or HiWord of wParam). How to prevent max limit in the subclass of WM_HSCROLL?
I attach the class.
Last edited by Jonney; Apr 27th, 2014 at 04:09 AM.
I find another demo on VBAccelerator. Obviously, the scrollbar has exactly the same problem. That means the original class has the problem instead of my code. Can anyone fix it? Thanks in advance.
FYI, I remembered the great sGrid2 scrollbar also had the same problem.
I attach the demo.
[Edited] in frmScrollDemo3, put debug.print in code:
Code:
Private Sub m_cScroll_Change(eBar As EFSScrollBarConstants)
Debug.Print m_cScroll.Value(efsHorizontal), m_cScroll.Max(efsHorizontal), m_cScroll.LargeChange(efsHorizontal), m_cScroll.SmallChange(efsHorizontal)
m_cScroll_Scroll eBar
End Sub
Fast moving Horizontal scrollbar to the end, the Value is bigger than Max by 1 pixel:
502 501 250 48
Last edited by Jonney; Apr 27th, 2014 at 04:30 AM.
Re: [RESOLVED] VBAccelerator Scrollbar Class Issue
Took a look now and found, that the calculation for the Max-Member of the SBInfo-Struct was off by one...
Also changed the behaviour to being fully compatible to the Min/Max/LargeChange-behaviour of the VB6-Scrollers.
Below is a reduced example of the original Zip you provided, which allows shifting the same
Client-Picture with both Scroller-approaches - either per API-Scrollers or alternatively with the normal VB-Scrollers.
Re: [RESOLVED] VBAccelerator Scrollbar Class Issue
Originally Posted by Schmidt
Took a look now and found, that the calculation for the Max-Member of the SBInfo-Struct was off by one...
Also changed the behaviour to being fully compatible to the Min/Max/LargeChange-behaviour of the VB6-Scrollers.
Below is a reduced example of the original Zip you provided, which allows shifting the same
Client-Picture with both Scroller-approaches - either per API-Scrollers or alternatively with the normal VB-Scrollers.