问题
It's probably a no brainer, but I've spent the last 40 minutes or so looking for it to no avial.
I have a Canvas control with a fixed width and a horizontal scrollbar. I'm trying to find the actual width of the control. The .width (fixed width) + the part being revealed by the scrollbar. I tried explicitWidth, width + maxHorizontalScrollPosition, and some other combos but non of them hit the spot.
回答1:
Well as it seem width + maxHorizontalScrollPosition
is indeed enough.
The problem was with the order of events in my application (the scrollbar didn't have enough time to update it's display). I ended up adding a custom event to the class representing the content of the Canvas.
来源:https://stackoverflow.com/questions/2670280/canvas-total-width-visible-width-hidden-scrollable-part