[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 :( )
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.
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 :o