简体   繁体   中英

C# - how to set up vertical scrollbar in a panel?

I need help to make vertical scrollbar work with the panel to scroll down the panel, i tried to make AutoScroll = true but not work, so how I can set yp the vertical scrollbar?? Thanks

Assuming your panel is named panel1(or else replace it),try the following and you shall see the scrollbars:

Button b = new Button();
b.Location = new Point(20, panel1.Height + 20);
panel1.Controls.Add(b);

I just added a button for demonstration purposes you add whatever you need. Or as i said in the comments using the autoscrollminsize:

panel1.AutoScrollMinSize = new Size(panel1.Width + 50, panel1.Height + 50);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM