|
-
Senior Member
I assume you're talking about stretching the body of the scrollbar, but not stretching the "thumb" or the buttons on either end.
In the following example, I'm assuming you're making a vertical scrollbar, although the same principles apply for a horitontal one as well.
One method you might consider is making the part that stretches a 'sibling' to the parts that don't stretch (rather than a 'parent').
You'd have a parent object which doesn't stretch (scrollbar). It contains the following parts:
scrollbar.bar (stretches)
scrollbar.up_arrow (doesn't stretch)
scrollbar.down_arrow (doesn't stretch)
scrollbar.thumb (doesn't stretch)
Another method would be to compute the scale of the parts that don't stretch as the inversion of the parent object's scale. So when the parent object is at 200%, the parts that don't stretch are at 50%.
Here's the math:
ratio = bar._yscale / 100;
thumb._yscale = 100 * 1/ratio;
This reduces algebraically to:
thumb._yscale = 100*(100/bar._yscale);
or
thumb._yscale = 10000/bar._yscale;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|