'分别放置一个Frame,picture,Hscrollbar和Vscrollbar到窗体上,并且图片框包含在框架中 Private Sub Form_Load() Picture1.Picture = LoadPicture("d:\006.jpg") If Picture1.Width > Frame1.Width Then HScroll1.Max = Picture1.Width - Frame1.Width Else HScroll1.Visible = False End If If Picture1.Height > Frame1.Height Then VScroll1.Max = Picture1.Height - Frame1.Height Else VScroll1.Visible = False End If End SubPrivate Sub HScroll1_Change() Picture1.Left = -HScroll1.Value End SubPrivate Sub VScroll1_Change() Picture1.Top = -VScroll1.Value End Sub
Private Sub Form_Load()
Picture1.Picture = LoadPicture("d:\006.jpg")
If Picture1.Width > Frame1.Width Then
HScroll1.Max = Picture1.Width - Frame1.Width
Else
HScroll1.Visible = False
End If
If Picture1.Height > Frame1.Height Then
VScroll1.Max = Picture1.Height - Frame1.Height
Else
VScroll1.Visible = False
End If
End SubPrivate Sub HScroll1_Change()
Picture1.Left = -HScroll1.Value
End SubPrivate Sub VScroll1_Change()
Picture1.Top = -VScroll1.Value
End Sub