how to add Vscroll control to form in Visualbasic.net?

拟墨画扇 提交于 2019-12-25 14:50:08

问题


i need to add vscroll control to a form in VB.net and i need to use it to scroll the form where i need to add more controls in the form where the size of form not able me to add them ?

and i need to know how to make the scrolling to show more controls in the form ?

thank you in advance


回答1:


I think you want the form's AutoScroll property.




回答2:


"Vscroll" is not the name of a control, but I assume it's an abbreviation for vertical scrollbar.

In that case, you can simply add a VScrollBar control to your form. You'll find it in the Toolbox under the "All Windows Forms" category. Unfortunately, you'll have to wire it up yourself. By default, the control won't do anything exciting.

HScroll and VScroll are also properties of any control that derives from ScrollableControl, such as a form and all panel controls. By setting one or both of these properties to "True", you can cause a horizontal or vertical scroll bar to appear, no additional control required.

But before you embark too far down this road, I should caution you against reinventing the wheel. Controls that derive from ScrollableControl also have an AutoScroll property that will cause scrollbars to appear automatically when the content they contain does not fit in the viewable area of the control. Simply set this property to "True", and let the magic happen. It maintains the visibility of the scrollbars automatically, eliminating the need to use a separate control or set the HScroll or VScroll properties.

If I were you, I would add either a TableLayoutPanel or a FlowLayoutPanel control to my form, and then place all of the other controls I wanted to add inside of the panel. Then, I would just turn on the AutoScroll property and let the control maintain everything automatically.



来源:https://stackoverflow.com/questions/5817251/how-to-add-vscroll-control-to-form-in-visualbasic-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!