HorizontalSlider?

Is there a way to change the dragged areas color, it might be easier to understand from a picture:
34952-untitled.png

So what I want is that if the value is 50 then 50% of it should be painted red.

Do you mean like a health bar? Or is this something the user clicks and drags with the mouse? In any case, I think the easiest solution is to superimpose boxes of different sizes, one gray with a fixed size in the bottom, then the red, width a variable width on top.