7,785
社区成员




Option Explicit
Private m_pic As IPictureDisp
Private m_Width As Long
Private m_Height As Long
Private Sub DrawPicture()
Me.Cls
Me.PaintPicture m_pic, -HScroll1.Value, -VScroll1.Value
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
Me.ScaleMode = vbPixels
Set m_pic = LoadPicture("C:\WINDOWS\Web\Wallpaper\Bliss.bmp")
m_Width = ScaleX(m_pic.Width, vbHimetric, vbPixels)
m_Height = ScaleY(m_pic.Height, vbHimetric, vbPixels)
End Sub
Private Sub Form_Resize()
Dim lClientWidth As Long
Dim lClientHeight As Long
lClientWidth = Me.ScaleWidth - 24
lClientHeight = Me.ScaleHeight - 24
HScroll1.Move 0, lClientHeight, lClientWidth, 24
If lClientWidth >= m_Width Then
HScroll1.Max = 0
Else
HScroll1.Max = m_Width - lClientWidth
HScroll1.LargeChange = lClientWidth
End If
VScroll1.Move lClientWidth, 0, 24, ScaleHeight
If lClientHeight >= m_Height Then
VScroll1.Max = 0
Else
VScroll1.Max = m_Height - lClientHeight
VScroll1.LargeChange = lClientHeight
End If
DrawPicture
End Sub
Private Sub HScroll1_Change()
DrawPicture
End Sub
Private Sub VScroll1_Change()
DrawPicture
End Sub