CoderMan
26th February 2012, 21:09
Yo!
I'm trying to make a one-dimensional horizontal indicator that has a background color and on top of that a colored field whose width changes based on input: at 0% only background is seen, at 20% the leftmost fifth is colored with the foreground color and at 100% only foreground color is seen.
I tried to go with two labels but I'm having trouble getting them to align right on top of each other in a layout. Any ideas?
An additional difficulty: the width of this entire control is subject to change. How do I recompute the overlay size while avoiding infinite recursion in a resize event? I suspect layouts will not help here, since they will start shrinking the background label before starting to shrink the (smaller) overlay, distorting the displayed value.
Thanks in advance, I really could use help on this one.
I'm trying to make a one-dimensional horizontal indicator that has a background color and on top of that a colored field whose width changes based on input: at 0% only background is seen, at 20% the leftmost fifth is colored with the foreground color and at 100% only foreground color is seen.
I tried to go with two labels but I'm having trouble getting them to align right on top of each other in a layout. Any ideas?
An additional difficulty: the width of this entire control is subject to change. How do I recompute the overlay size while avoiding infinite recursion in a resize event? I suspect layouts will not help here, since they will start shrinking the background label before starting to shrink the (smaller) overlay, distorting the displayed value.
Thanks in advance, I really could use help on this one.