I am building a Windows form with multiple panels. I have a large panel as the base on the form, with a tab control on top of it, docked to fill, and multiple panels on the tab control. The base panel is docked to top of the form, with another panel below it, docked to the bottom. I also have a tool bar, and menu bar docked to the top of the form above the base panel. The problem I am having is that when I resize the form, I get a vertical scroll bar, but no horizontal scroll bar. I have autoscroll set to true, so not sure what the issue is. Do the panels on the tab control, or the tab control itself interfere with the horizontal scrolling?

06-24-2007, 04:31 PM

TwoFaced

Controls that are set to dock on the bottom or top will maintain the same width as the form. This means there will never be any reason to scroll horizontally. The only reason your controls wouldn't fit width wise is if you set a minimum width. Did you do this? I tested this out for myself and it appears even with a minimum width set the horizontal scrollbar will not appear. I'm not sure why this is. Unfortunatly I can't help much more then to confirm what's happening is the way it is.

06-24-2007, 04:38 PM

rahvyn

I have not set a minimum width. I was under the impression that when the form was resized, that if the controls were larger then the form, in this case, the base panel, that you would automatically get scrollbars.

06-24-2007, 04:51 PM

RobDog888

Yes, your assumption is correct but since you have it set to dock fill it wont add a horizontal scrollbar like already mentioned. If you change the docking you shold be able to get it to add the sb.

06-24-2007, 05:03 PM

rahvyn

My bad, I should have explained better what's happening. I have the base panel. On that, I have a tab control. On that, I have 2 panels, that basically split the tab control in half. I changed the docking to top for the base panel, and did get a horizontal scroll bar for the right panel on the tab control. However, what I'm trying to get, is a scroll bar for the entire base panel, that when the form is sized smaller than the width of the tab control, which has the 2 panels on it, I will get scroll bars for the entire base panel, that would allow scrolling to be able to see both sub panels on the tab control.

06-24-2007, 05:23 PM

RobDog888

Ok, so you are getting horizontal scrollbar for the base panel and not the other panels is what you are saying? Can you provide a small screen shot of the situation?

06-24-2007, 05:43 PM

rahvyn

1 Attachment(s)

Yes, see attachment. As you can see below, the scroll bar is in the right sub pane, but there is no scroll bar on the base panel. I guess what I'm really looking for here is to get scroll bars like you would in Internet Explorer when you resize the window smaller.

06-24-2007, 05:53 PM

RobDog888

Oh ok. So the large tab on the left should be coupled together witht he panel on the right which currently has a scrollbar.
If you make the panel on the left and right fixed in size then the parent panel will display the scrollbar/ Since the right panel is collasping with a horizontal scrollbar it prevents the parent panel from needing to add a scrollbar since it actiually fits int he area. ;)

06-24-2007, 06:14 PM

rahvyn

I must still be doing something wrong. I tried the following:

1 - turned off all autoscroll except on base panel - no scroll bars appeared while resizing

2 - Turned off all autoscroll except on the form itself. I can get vertical scrolls, but not horizontal.

06-24-2007, 06:28 PM

TwoFaced

I believe you said in your first post that the tabcontrol was set to 'fill'. This means the panel is not going to scroll because the tabcontrol will take on whatever size the panel is. As far as scrolling is concerned the container only cares about it's child controls...not it's children's children. So the fact that the panel's inside the tabcontrol don't fit won't cause the base panel to scroll. The way to accomplish your goal is to not dock the tabcontrol.

06-24-2007, 06:28 PM

RobDog888

Does the base panel have auto scrollbars on?

06-24-2007, 06:41 PM

rahvyn

Ok, almost got it, I turned off the docking on the tab control, and that caused the scroll bars to appear. The only thing I have left to figure out is, when I resize the form to a smaller height, I lose the bottom scrollbar. I maintain the vertical one, but not the horizontal.

06-24-2007, 06:49 PM

rahvyn

Got it figured out. I set the base panel to fill. That did it. Thanks for all the help guys.

04-11-2014, 12:17 AM

makaveiljojo

This is a very good question that offered me so many insights to the panel control. Though I know panel for a long time, I still have many problems on the panel scrollbar.