hi
i want set the scroll bar on a form.
becoz the application form exceeds the vb form
plz help me asap
bye
sandesh
Printable View
hi
i want set the scroll bar on a form.
becoz the application form exceeds the vb form
plz help me asap
bye
sandesh
Here's something on this topic
http://forums.vb-world.net/showthrea...threadid=18740
http://forums.vb-world.net/showthrea...threadid=11227
Try this.
Code:Dim VPos As Integer
Dim HPos As Integer
Private Sub Form_Load()
'Change the following numbers to the Full height and width of your Form
intFullHeight = 8000
intFullWidth = 8000
'This is the how much of your Form is displayed
intDisplayHeight = Me.Height
intDisplayWidth = Me.Width
With VScroll1
.Height = Me.ScaleHeight
.Min = 0
.Max = intFullHeight - intDisplayHeight
.SmallChange = Screen.TwipsPerPixelX * 10
.LargeChange = .SmallChange
End With
With HScroll1
.Width = Me.ScaleWidth
.Min = 0
.Max = intFullWidth - intDisplayWidth
.SmallChange = Screen.TwipsPerPixelX * 10
.LargeChange = .SmallChange
End With
End Sub
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) And Not (TypeOf CTL Is HScrollBar) 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
Else
'Scroll Horizontally
For Each CTL In Me.Controls
'Make sure it's not a ScrollBar
If Not (TypeOf CTL Is VScrollBar) And Not (TypeOf CTL Is HScrollBar) Then
'If it's a Line then
If TypeOf CTL Is Line Then
CTL.X1 = CTL.X1 + HPos - HScroll1.Value
CTL.X2 = CTL.X2 + HPos - HScroll1.Value
Else
CTL.Left = CTL.Left + HPos - HScroll1.Value
End If
End If
Next
HPos = HScroll1.Value
End If
End Sub
Private Sub HScroll1_Change()
ScrollForm 1
End Sub
Private Sub HScroll1_Scroll()
ScrollForm 1
End Sub
Private Sub VScroll1_Change()
ScrollForm 0
End Sub
Private Sub VScroll1_Scroll()
ScrollForm 0
End Sub