Mimicking the AutoScroll functionality
-
I am curious as to how the auto-scroll feature works in the .NET scrollable controls. How does it set the view-port into the virtual space of a control’s draw-able space? I understand how to do it if I have a definable space (say like using a bitmap etc. with defined unchanging bounds) but am not sure how to do this if the region I’m using is infinite with changing bounds. I have a situation where the width and height are fully scalable and dynamic with other controls (that know how to draw themselves in the proper place on their parent control) being “drawn” on the virtual area. I can get this to work with auto-scroll (I keep changing the AutoScrollMinSize as it changes) until I look at the requirement that another control above it (same width) has to scroll in lock-step for the horizontal scrolling. The documentation states that you can set the AutoScroll property to true and then optionally turn off the horizontal or vertical scroll bars by setting the protected members HScrollBar or VScrollBar to false. In practice, it doesn’t seem to work for me. If the AutoScrollMinSize property changes (which mine do constantly), it resets the values to true. At this point, even if I reset the variables back to false, they still show up regardless of how they were set and I have scroll bars where I don’t want them. Here are my questions: •Is there a way to make the auto vertical/horizontal scroll-bars stay invisible with AutoScroll turned on (like the documentation states)? •If not, what is the best way to override this functionality to mimic the auto-scroll functionality? I’d really like to not have to play with the WM_H/VSCROLL window messages. But if this is the best way, again, how do I change the view-port position into the virtual space I’m using? •Is there a better way? Thanks, Mike