Visual Basic Foro
Programación => Visual Basic 6 => Mensaje iniciado por: Jen en Abril 28, 2014, 05:15:17 am
-
I am trying to use VBAccelerator Scrollbar class to scroll picture in picturebox. But I noticed the thumb position exceed MAX value by 1 pixes.
For example:
My picturebox's ScaleWidth is 600 pixels,the picture has 1000 pixels width.
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 moving the Thumb to the right end, the debug window shows 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 because Max is 400.
I found another demo on VBAccelerator. Obviously, the scrollbar has exactly the same problem. That means the original class has the problem instead of my code.
FYI, I remembered the great sGrid2 scrollbar also had the same problem.
Even though the problem is small, but quite annoying...
(http://www.vbforums.com/attachment.php?attachmentid=113317&stc=1&d=1398566313)
Attachment:
http://www.vbforums.com/attachment.php?attachmentid=113339&d=1398582988 (http://www.vbforums.com/attachment.php?attachmentid=113339&d=1398582988)
-
Jen, vbaccelerator have a full picturebox scroll example on its site.
http://www.vbaccelerator.com/home/VB/Code/Controls/Scroll_Bars/article.asp
-
VBAccelerator is the best side for advance stuff. But I found nothing regarding the scrollbar's bugs. After debugging, I put offset -1 in MAX calculation and checking codes in Value calculation. Problem resolved.
The fix is here: http://www.vbforums.com/showthread.php?762497-RESOLVED-VBAccelerator-Scrollbar-Class-Issue&p=4663499&viewfull=1#post4663499