Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scroll Bars

Status
Not open for further replies.

gzosh

Programmer
Jun 18, 2001
5
0
0
US
Does anyone know how to increase the size of a form using scroll bars so that the form can be larger than the screen?

 
In the scroll event of the scrollbar, you have to go through every control on the form and increase or decrease its .top value in accordance with the .value of the scrollbar.
 
One method would be to add an MDI form to your project, and then make your form an MDI child. Set the borders of your form to none. You may also want to set the caption of the MDI form to be the same as that of your original form.

And that's it. You should not need to change or write any additional code. The one caveat is that MDI children cannot be shown modally.

Regards,
Mike
 
This code works great for me. Let me know how it works for you.

Dim VPos As Integer

Private Sub VScroll1_Change()
Call ScrollForm(0)
End Sub

Private Sub VScroll1_Scroll()
Call ScrollForm(0)
End Sub

Public Sub ScrollForm(Direction As Byte)
Dim ctl As Control

'Scroll Vertically
If Direction = 0 Then
For Each ctl In Me.Controls
'Make sure it's not a ScrollBar
If Not (TypeOf ctl Is VScrollBar) Then
'If it's a Line then
If TypeOf ctl Is Line Then
ctl.Y1 = ctl.Y1 + VPos - VScroll1.Value
ctl.Y2 = ctl.Y2 + VPos - VScroll1.Value
Else
ctl.Top = ctl.Top + VPos - VScroll1.Value
End If
End If
Next
VPos = VScroll1.Value
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top