Scroll Bar

G

Guest

I use the following code to add a vScrollbar to a form. How do I get it so if the form height is changed, the scroll bar maximum is changed to reflex then new size. The lastControl is the last Control on the form, which would be the height of the form. I call this on resize of the form. It works fine it the form is not resized. If the form is shortened, the scroll bar does not scroll down to the last control. It the form is lengthened, the scroll bar scrolls to far

Private Sub SetupVscroll(
Dim iFullFormHeight As Lon
Dim iDisplayHeight As Lon

iFullFormHeight = lastControl.Top + lastControl.Height ' - 5
theScrollBar = New VScrollBar(
With theScrollBa
.Parent = M
.SetBounds(Panel1.Left + Panel1.Width + 1, Panel1.Top, 16, 248
.Height = Panel1.Heigh
.Minimum =
.Maximum = iFullFormHeigh
.SmallChange = 10
.LargeChange = .SmallChange * 2
.Show(
End Wit
End Su

Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top