Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
Dim mybit As New System.Drawing.Bitmap(PictureBox1.Image)
Dim mypicgrh As System.Drawing.Graphics = Me.PictureBox1.CreateGraphics
mypicgrh.Clear(Me.PictureBox1.BackColor)
mypicgrh.DrawImageUnscaled(mybit, m_leftx - HScrollBar1.Value, PictureBox1.Location.X)
'减去6:是picturebox1距离窗口左边的距离
mypicgrh.DrawImageUnscaled(mybit, PictureBox1.Location.X - 6 - HScrollBar1.Value, m_lefty)
m_leftx = PictureBox1.Location.X - 6 - HScrollBar1.Value
mybit.Dispose()
mypicgrh.Dispose()
DoubleBuffered = True
End Sub
Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll
Dim mybit As New System.Drawing.Bitmap(PictureBox1.Image)
Dim mypicgrh As System.Drawing.Graphics = Me.PictureBox1.CreateGraphics
mypicgrh.Clear(Me.PictureBox1.BackColor)
'减去82是picturebox1距离窗口顶端的距离
mypicgrh.DrawImageUnscaled(mybit, m_leftx, PictureBox1.Location.Y - 82 - VScrollBar1.Value)
m_lefty = PictureBox1.Location.Y - 82 - VScrollBar1.Value