Vertical Scroll in FlowLayoutPanel
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Vertical Scroll in FlowLayoutPanel

  1. #1
    Join Date
    Apr 2008
    Location
    Kentucky
    Posts
    73

    [RESOLVED] Vertical Scroll in FlowLayoutPanel

    I'm creating an application that will have a FlowLayoutPanel that is populated with custom controls. The number of controls in the panel will vary and may at times be more than can be displayed within the limits of the panel. I would like to add a vertical scrollbar only as need, but do not want a horizontal scrollbar at all. Using '.AutoScroll=true' adds both when the vertical only is needed.

    Question is: How can I either A) use autoscroll and only have a vertical scrollbar or B) add a VScrollBar attached to the panel for scrolling but only visible when needed?

    (I searched for both but couldn't find anything all that helpful )
    Last edited by yraen; November 12th, 2008 at 02:45 PM. Reason: Resolved, didn't have the option to 'Mark this thread Resolved'

  2. #2
    Join Date
    Sep 2004
    Posts
    1,361

    Re: Vertical Scroll in FlowLayoutPanel

    I am not sure about this, but set AutoScroll to true. Then as a test just populate it with more controls then will fit. For me, when that happens, a vertical scroll bar appears automatically.

    I have mine set to fill left to right, and wrap contents = true

    I only get a vertical scroll bar, not a horizontal one.

    Here are the settings mine have, the ones that deviate from the defaults. Don't use them all because part of it is size and positioning.
    Code:
    this.flpOverview.AutoScroll = true;
                this.flpOverview.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                this.flpOverview.Location = new System.Drawing.Point( 3, 64 );
                this.flpOverview.Name = "flpOverview";
                this.flpOverview.Size = new System.Drawing.Size( 401, 332 );
                this.flpOverview.TabIndex = 4;
    Maybe if you make sure that your layout panel is about the size of the items inside; Like you want 5 across, the box is just big enough to fit 5 across, not 5.5 across.
    Last edited by DeepT; November 7th, 2008 at 04:15 PM.

  3. #3
    Join Date
    Apr 2008
    Location
    Kentucky
    Posts
    73

    Re: Vertical Scroll in FlowLayoutPanel

    I figured out what was causing it finally. It was a dumdum on my part. My custom control had a width of 300, and my form had a width of 325. So, of course, when the vertical scroll bar appeared, it cut off ~30 width from the panel which put part of my custom control outside the view.

    So, uhh... stupid mistake

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center