Dim iFullFormHeigth As Long 'integer
Dim iFullFormWidth As Long 'integer
Private Sub Form_Resize()
VScroll1.Left = Me.Width - (1.45 * VScroll1.Width)
HScroll1.Top = Me.Height - (2.45 * HScroll1.Height)
Picture1.Left = VScroll1.Left
Picture1.Top = HScroll1.Top
'If the full screen is already showing,
'then disable the scrollbar
VScroll1.Enabled = (iFullFormHeigth - Me.Height) >= 0
'First, make sure we aren't minimized
If Me.ScaleHeight > HScroll1.Height And Me.Width > VScroll1.Width Then
'If there is any more screen to see,
'modify the scrollbar
If VScroll1.Enabled Then
With VScroll1
.Height = Me.ScaleHeight - HScroll1.Height
.Min = 0
.Max = iFullFormHeigth - Me.Height
.SmallChange = Screen.TwipsPerPixelY * 10
.LargeChange = Me.ScaleHeight - HScroll1.Height
End With
'Otherwise, just resize the scrollbar for neatness
Else: VScroll1.Height = Me.ScaleHeight - HScroll1.Height
End If
HScroll1.Enabled = (iFullFormWidth - Me.Width) >= 0
If HScroll1.Enabled Then
With HScroll1
.Width = Me.ScaleWidth - VScroll1.Width
.Min = 0
.Max = iFullFormWidth - Me.Width
.SmallChange = Screen.TwipsPerPixelX * 10
.LargeChange = Me.ScaleWidth - VScroll1.Width
End With
Else: HScroll1.Width = Me.ScaleWidth - VScroll1.Width
End If
End If
End Sub
|