Horizontal Scrollbar on Panel Control


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 14 of 14

Thread: Horizontal Scrollbar on Panel Control

  1. #1
    Join Date
    Jun 2007
    Posts
    9

    Horizontal Scrollbar on Panel Control

    Hi All;

    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?

  2. #2
    Join Date
    Jan 2007
    Posts
    112
    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.

  3. #3
    Join Date
    Jun 2007
    Posts
    9
    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.

  4. #4
    Join Date
    Mar 2005
    Location
    Los Angeles, Calif. AKA: Gangsta Yoda™
    Posts
    455
    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer code questions via PMs.
    Microsoft MVP 2006-2009
    Office Development FAQ (VBA, VB6, VB.NET, C#)
    Software Engineer MCP (VB6 & .NET)
    Reps & Rating PostsVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address List

  5. #5
    Join Date
    Jun 2007
    Posts
    9
    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.

  6. #6
    Join Date
    Mar 2005
    Location
    Los Angeles, Calif. AKA: Gangsta Yoda™
    Posts
    455
    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?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer code questions via PMs.
    Microsoft MVP 2006-2009
    Office Development FAQ (VBA, VB6, VB.NET, C#)
    Software Engineer MCP (VB6 & .NET)
    Reps & Rating PostsVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address List

  7. #7
    Join Date
    Jun 2007
    Posts
    9
    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.
    Attached Images Attached Images
    Last edited by rahvyn; 06-24-2007 at 05:46 PM.

  8. #8
    Join Date
    Mar 2005
    Location
    Los Angeles, Calif. AKA: Gangsta Yoda™
    Posts
    455
    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer code questions via PMs.
    Microsoft MVP 2006-2009
    Office Development FAQ (VBA, VB6, VB.NET, C#)
    Software Engineer MCP (VB6 & .NET)
    Reps & Rating PostsVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address List

  9. #9
    Join Date
    Jun 2007
    Posts
    9
    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.

  10. #10
    Join Date
    Jan 2007
    Posts
    112
    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.
    Last edited by TwoFaced; 06-24-2007 at 06:30 PM.

  11. #11
    Join Date
    Mar 2005
    Location
    Los Angeles, Calif. AKA: Gangsta Yoda™
    Posts
    455
    Does the base panel have auto scrollbars on?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer code questions via PMs.
    Microsoft MVP 2006-2009
    Office Development FAQ (VBA, VB6, VB.NET, C#)
    Software Engineer MCP (VB6 & .NET)
    Reps & Rating PostsVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address List

  12. #12
    Join Date
    Jun 2007
    Posts
    9
    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.

  13. #13
    Join Date
    Jun 2007
    Posts
    9
    Got it figured out. I set the base panel to fill. That did it. Thanks for all the help guys.

  14. #14
    Join Date
    Dec 2013
    Posts
    24
    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.

Similar Threads

  1. Replies: 1
    Last Post: 08-01-2006, 02:12 AM
  2. Managing a panel control dynamically
    By k_rads in forum ASP.NET
    Replies: 2
    Last Post: 02-17-2006, 08:22 AM
  3. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 12:45 PM
  4. combobox horizontal scrollbar
    By adam adam in forum VB Classic
    Replies: 0
    Last Post: 12-28-2000, 12:33 PM
  5. combobox horizontal scrollbar
    By adam adam in forum VB Classic
    Replies: 0
    Last Post: 12-28-2000, 12:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center