Click here to Skip to main content
15,943,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need a scrollbar (horizontal and vertical) in a panel, without autoscroll because i want that panel starts with the scrollbar displayed and have a max and min value... Using WinForms
Updated 21-Oct-13 9:28am
Rob Philpott 21-Oct-13 15:24pm    
WPF or WinForms?
Rieth L 21-Oct-13 15:27pm    
Nelek 21-Oct-13 15:35pm    
Rieth L 21-Oct-13 15:36pm    
Put a panel with a weight and height inside an other panel with autoscroll = true...
Rieth L 21-Oct-13 15:37pm    
Panel1 p1= new Panel();
p1.AutoScroll = true;

Panel2 p2 = new Panel();
p2.height = 100;
p2.width = 100;


Something like it

If what you are asking is how do you force scrollbars to appear when a Panel Control in WinForms does not have "content" in it that would force scroll-bars to appear if its 'AutoScroll Property was 'true:

Set the Width and Height values of the 'AutoScrollMinSize Property of the Panel greater than the Width and Height of the Panel.
Share this answer
Rob Philpott 22-Oct-13 1:37am    
Yes, that's it!
Rieth L 22-Oct-13 6:22am    
It work, but when i scroll it doesn't down or up...
Right I'm going from memory here so you'll need to check, but Panel is derived from ScrollableControl. This means it should have methods/properties (I can't remember the names) to set the autoscroll mode, and the extent. I've used these when developing controls in the past.

Drop me a line if you can't find them and I'll have a look.
Share this answer
Try this

panel.VerticalScroll.Visible = true
panel.HorizontalScroll.Visible = true

Source -[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900