Question

Is there any way to scroll in a StatusStrip when its controls exceed form viewing area? My StatusStrip acts as a taskbar with a lot of labels (acting as buttons) which if there are too many might go outside the bounds of the screen.

Was it helpful?

Solution

I have never seen a scrolling status bar control in any Windows application I've ever used.

You might think that's quite an irrelevant point, but I mention it for a reason. There's a huge advantage in designing applications that are consistent with your platform's conventions, and therefore your user's expectations. Those applications are much easier to write (breaking the rules is always harder than following them) and much easier for users to understand and use.

It's very likely that, even if there is a scrollbar, users will never find it and use it because they aren't expecting to find a scrollbar on a status bar control. I certainly wouldn't be. I'd look down there for the information I'd expect to find, not find it, and get frustrated. Like most users, I wouldn't bother reading the documentation to understand that I have to scroll something that is never scrollable. I'd just conclude your app has a bad UI and be done with it.

And in fact, despite what you and I as programmers might think of the typical [dumb] user, I as the typical dumb user would be quite correct! Your application does have a bad UI because it's non-standard and difficult to use. This is something that lots of programmers don't understand or appreciate, but it's extremely important.

Therefore, I highly recommend that you re-consider your application's UI design. The primary focus (and just general good design) should be on ensuring that vital information is displayed or accessible multiple places, not just in the status bar. Another option is to display less of that information in the status bar. Much like Windows Explorer, you should automatically hide the less important information when your available screen real estate shrinks, and display more of it when you have the necessary room to do so. Make an explorer window really small and you'll only see the bare essentials down in the status bar.

But if you decide to ignore all of this advice and bungle through what you've already decided upon, keep reading... The StatusStrip control inherits from ScrollableControl, which means that it has such properties as AutoScroll and HScroll. But the documentation indicates that such properties are:

Infrastructure. This property is not relevant for this class.

That means they're not supported on the StatusStrip control. You might be able to inherit from StatusStrip and write your own scrolling code, but that sounds like a lot of work to me.

The simpler solution is probably to dock a Panel control at the bottom of your form, and then place a StatusStrip control inside of that Panel. Make sure that you set the AutoScroll property of the container Panel control, and it should automatically expand (with scrollbars) to display the entire StatusStrip control.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top