How to get scrollbar in a panel in VB.Net?

I am developing a Windows application in VB.Net. In this case, there is one case when there is one form, and there is a panel in this form, and inside the panel there is a rich text field.

So, my requirement is to get the scroll bar in the panel. Therefore, when the user scrolls in the panel, the text field with rich text can scroll accordingly, as well as the functions of MS Office.

Can someone give me an idea how to do this?

+7
source share
3 answers

Set the .Dock property to FILL and the .WordWrap property to FALSE for richtextbox.

Also set the Panel.Dock property to FILL.

+6
source

Set Panel.AutoScroll = True , and the scroll bars will be automatically displayed whenever any controls on the panel go beyond it.

+16
source

To use the autoscroll property of the panel, I do this:

 panel.AutoScroll = true panel.VerticalScroll.Visible = False or panel.HorizontalScroll.Visible = False 

To find out the dimensions of the scrapers, use

 SystemInformation.HorizontalScrollBarHeight SystemInformation.VerticalScrollBarWidth 

This way you can resize the panel when scroolbar is displayed.

+5
source

All Articles