-
Dec 6th, 2022, 06:07 AM
#1
Thread Starter
Addicted Member
How to add scrollbar to a flow layout control?
Hi all,
I added too many items to a flow layout control oriented from top to bottom, representing a sort of toolbox but now it contains too much components that I even unable to see them.
- How can I add a vertical scroll bar to navigate only from top to bottom of flow layout panel?
- Is there another proper control to do same thing, scrollable while subitems reach out of user monitor size?
-
Dec 6th, 2022, 06:25 AM
#2
Re: How to add scrollbar to a flow layout control?
Hi Pourkascheff
This'll do the trick.
Code:
FlowLayoutPanel1.HorizontalScroll.Visible = True
FlowLayoutPanel1.VerticalScroll.Visible = True
Add it to the form load subroutine. (Obviously you only need the vertical in this case)
Poppa
Last edited by Poppa Mintin; Dec 6th, 2022 at 06:32 AM.
Along with the sunshine there has to be a little rain sometime.
-
Dec 6th, 2022, 06:49 AM
#3
Thread Starter
Addicted Member
Re: How to add scrollbar to a flow layout control?
Thank you sir. I only checked its properties in property grid and it wasn't available there but it seems in code things are in godmode.
I added them both in Form1 load event but nothing happened. Neither of them are unavailable. Even mouse scroll does not work.
Info: FlowLayoutPanel1 WrapContents is false.
-
Dec 6th, 2022, 04:05 PM
#4
Re: How to add scrollbar to a flow layout control?
There are a few controls that don't expose all of their properties in the designer. In those cases, you do have to take care of it in code. Kind of annoying, but that's life.
My usual boring signature: Nothing
 
-
Dec 7th, 2022, 08:18 PM
#5
Re: How to add scrollbar to a flow layout control?
 Originally Posted by pourkascheff
I added them both in Form1 load event but nothing happened. Neither of them are unavailable. Even mouse scroll does not work.
Info: FlowLayoutPanel1 WrapContents is false.
Ok, I made the assumption that your FlowLayoutPanel is named 'FlowLayoutPanel1'. The quote I've highlighted in red suggests that you have two FlowLayoutPanels, in order to have a vertical scroll bar in each, you will just need...
Code:
FlowLayoutPanel1.VerticalScroll.Visible = True
FlowLayoutPanel2.VerticalScroll.Visible = True
...in your Form's Load Event.
Again assuming the second FlowLayoutPanel is named 'FlowLayoutPanel2'.
If your FlowLayoutPanels are contained within (say) a TableLayoutPanel you will need to adjust the commands to reflect that.
I have tried this code with the FlowLayoutPanel's WrapContents =False, but that made no difference to either scroll bar in my test project.
Poppa
PS.
Oh... I re-read your reply, maybe you meant you tried to add both scroll bars and (either) neither bar is available (there?) (or) both bars are unavailable. (not there)
Pop.
Last edited by Poppa Mintin; Dec 7th, 2022 at 08:27 PM.
Reason: PS added.
Along with the sunshine there has to be a little rain sometime.
-
Dec 8th, 2022, 11:06 AM
#6
Re: How to add scrollbar to a flow layout control?
 Originally Posted by pourkascheff
Thank you sir. I only checked its properties in property grid and it wasn't available there but it seems in code things are in godmode.
I added them both in Form1 load event but nothing happened. Neither of them are unavailable. Even mouse scroll does not work.
Info: FlowLayoutPanel1 WrapContents is false.
Try adding this
Code:
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
FlowLayoutPanel1.AutoScroll = False
FlowLayoutPanel1.HorizontalScroll.Visible = True
FlowLayoutPanel1.VerticalScroll.Visible = True
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|