Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const GWL_STYLE = (-16)
Public Const WS_VSCROLL = &H200000 垂直
Public Const WS_HSCROLL = &H100000 水平
http://www.csdn.net/expert/Topic/363/363018.shtm
Private Sub Scrollfunc()
With VScroll1
.Top = 0
.Left = Me.ScaleWidth - .Width
.Height = Me.ScaleHeight
End With
End Sub
Private Sub Form_Load()
Call Scrollfunc
End Sub
'分别放置一个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 Sub
Private Sub HScroll1_Change()
Picture1.Left = -HScroll1.Value
End Sub
Private Sub VScroll1_Change()
Picture1.Top = -VScroll1.Value
End Sub