T
Tom
My user defined vertical scroll bar does not respond properly.
public VScrollBar vs;
....
vs = new VScrollBar();
vs.Parent = this;
vs.Dock = DockStyle.Right;
I intercept the scrollbar events using the Visual Studio's very nice
automated event handler: >>
vs.Scroll += new ScrollEventHandler(vs_Scroll);
Then I programmatically calculate and set the desired new position for
the thumb in the LargeDecrement event: >>
public void vs_Scroll(object sender, ScrollEventArgs e)
{
if (e.Type == ScrollEventType.LargeDecrement)
{
vs.Value = iThumbLocation(); //The calculated result.
return;
}
}
The observed behavior is the thumb moves by the "LargeChange" amount
from the _original_ position. Upon losing focus, it then snaps to the
calculated value.
What is the smart solution here?
Do you somehow trap out the automated scrollbar behavior?
Or, should I be programmatically calculating and setting a new
"LargeChange" value to keep the "while still in focus scrollbar"
visually in sync with the calculated new position?
Unfortunately the false value also triggers another scroll event! What
a mess. It really had(has) me dumbfounded and the amount of time I've
spent writing out values to understand what was causing the visually
observed problem is good for a laugh. Please enlighten me! This is one
more learning adventure I'll very much enjoy having completed.
Thanks!!
-- Tom
public VScrollBar vs;
....
vs = new VScrollBar();
vs.Parent = this;
vs.Dock = DockStyle.Right;
I intercept the scrollbar events using the Visual Studio's very nice
automated event handler: >>
vs.Scroll += new ScrollEventHandler(vs_Scroll);
Then I programmatically calculate and set the desired new position for
the thumb in the LargeDecrement event: >>
public void vs_Scroll(object sender, ScrollEventArgs e)
{
if (e.Type == ScrollEventType.LargeDecrement)
{
vs.Value = iThumbLocation(); //The calculated result.
return;
}
}
The observed behavior is the thumb moves by the "LargeChange" amount
from the _original_ position. Upon losing focus, it then snaps to the
calculated value.
What is the smart solution here?
Do you somehow trap out the automated scrollbar behavior?
Or, should I be programmatically calculating and setting a new
"LargeChange" value to keep the "while still in focus scrollbar"
visually in sync with the calculated new position?
Unfortunately the false value also triggers another scroll event! What
a mess. It really had(has) me dumbfounded and the amount of time I've
spent writing out values to understand what was causing the visually
observed problem is good for a laugh. Please enlighten me! This is one
more learning adventure I'll very much enjoy having completed.
Thanks!!
-- Tom