'另放一個Hscroll, 一個VScroll 於Form上
Option Explicit
Sub Form_Load()
Picture1.BackColor = Me.BackColor
Picture1.BorderStyle = 0 '沒有框線
End Sub
Sub Form_Resize()
' Position the scroll bars:
HScroll1.Left = 0
VScroll1.Top = 0
If Picture1.Width > ScaleWidth Then 'picturebox比Form還寬時
HScroll1.Top = ScaleHeight - HScroll1.Height
Else
HScroll1.Top = ScaleHeight '如此Hscroll便不會顯示出來了
End If
If Picture1.Height > HScroll1.Top Then
VScroll1.Left = ScaleWidth - VScroll1.Width
If Picture1.Width > VScroll1.Left Then
HScroll1.Top = ScaleHeight - HScroll1.Height
End If
Else
VScroll1.Left = ScaleWidth '如此VScroll便不會出現了
End If
HScroll1.Width = ScaleWidth
If HScroll1.Top > 0 Then VScroll1.Height = HScroll1.Top
' Set the scroll bar ranges
HScroll1.Max = Picture1.Width - VScroll1.Left
VScroll1.Max = Picture1.Height - HScroll1.Top
HScroll1.SmallChange = Abs(HScroll1.Max \ 16) + 1
HScroll1.LargeChange = Abs(HScroll1.Max \ 4) + 1
VScroll1.SmallChange = Abs(VScroll1.Max \ 16) + 1
VScroll1.LargeChange = Abs(VScroll1.Max \ 4) + 1
HScroll1.ZOrder 0
VScroll1.ZOrder 0
End Sub
Sub HScroll1_Change()
Picture1.Left = -HScroll1.Value '更動PictureBox的位置
End Sub
Sub VScroll1_Change()
Picture1.Top = -VScroll1.Value
不知問題出在哪請幫忙
Option Explicit
Sub Form_Load()
Picture1.BackColor = Me.BackColor
Picture1.BorderStyle = 0 '沒有框線
End Sub
Sub Form_Resize()
' Position the scroll bars:
HScroll1.Left = 0
VScroll1.Top = 0
If Picture1.Width > ScaleWidth Then 'picturebox比Form還寬時
HScroll1.Top = ScaleHeight - HScroll1.Height
Else
HScroll1.Top = ScaleHeight '如此Hscroll便不會顯示出來了
End If
If Picture1.Height > HScroll1.Top Then
VScroll1.Left = ScaleWidth - VScroll1.Width
If Picture1.Width > VScroll1.Left Then
HScroll1.Top = ScaleHeight - HScroll1.Height
End If
Else
VScroll1.Left = ScaleWidth '如此VScroll便不會出現了
End If
HScroll1.Width = ScaleWidth
If HScroll1.Top > 0 Then VScroll1.Height = HScroll1.Top
' Set the scroll bar ranges
HScroll1.Max = Picture1.Width - VScroll1.Left
VScroll1.Max = Picture1.Height - HScroll1.Top
HScroll1.SmallChange = Abs(HScroll1.Max \ 16) + 1
HScroll1.LargeChange = Abs(HScroll1.Max \ 4) + 1
VScroll1.SmallChange = Abs(VScroll1.Max \ 16) + 1
VScroll1.LargeChange = Abs(VScroll1.Max \ 4) + 1
HScroll1.ZOrder 0
VScroll1.ZOrder 0
End Sub
Sub HScroll1_Change()
Picture1.Left = -HScroll1.Value '更動PictureBox的位置
End Sub
Sub VScroll1_Change()
Picture1.Top = -VScroll1.Value
不知問題出在哪請幫忙
全站熱搜
留言列表