Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Panel Auto Scroll - Vertical Only

Status
Not open for further replies.

jonbatts

Programmer
Apr 12, 2005
114
US
I can set a panels ScrollBars property to Vertical, to show only a vertical scrollbar, and Auto, to show scrollbars (vertical and horizontal) only when necessary. Is there a way to get a panel to scroll vertically, but not horizontally, and only when necessary? Sort of like a combination of Auto and Vertical. Thanks, and have a great day.
 
if you dock the controls inside the panel to the top the width will never show up. Turn on auto scroll and the vertical should automatically show up when you have more items in the list than can be displayed.

HOWEVER - I think i recall this being a problem at times. The scrollbar wouldn't show up.

The way around this is to not dock your object to the top of the panel. Instead make the object a couple of pixels less than the width of the panel and set the location of each item like this:

for (int i = 0; i < mycontrols.Length; i++)
{
mycontrols.Location = new Point(0, mycontrols.Height * i);

//This will put them all below eachother starting at the top.
}

With the autoscroll property set to true, the vertical will be the only one to show up.
 
So I'm sitting here thinking "Dock... dock... What does that mean and where have I heard it before?" D'OH! Dock, like you do with controls in .NET Applications, but not ASP.NET applications like I've been writing for the last 2 years. It's been so long since I've written an app that's not a web app. (Sorry for going on, it was funny to me).
So as you can tell I'm writing a web application. (Maybe I should have posted this in the ASP.NET forum?) Thanks for the help, though. Any idea what the ASP.NET equivalent could be? Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top