I get no errors but when the program is debugged the code doesn't work, nothing happens. Can someone please tell me what I should do?
Thank You!
Private m_PanStartPoint As New Point
Private Sub frmBirthdayCake_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Panel2.AutoScroll = True
'Picture Box Settings
PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize
End Sub
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
m_PanStartPoint = New Point(e.X, e.Y)
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
'Verify Left Button is pressed while the mouse is moving
If e.Button = Windows.Forms.MouseButtons.Left Then
'Here we get the change in coordinates.
Dim DeltaX As Integer = (m_PanStartPoint.X - e.X)
Dim DeltaY As Integer = (m_PanStartPoint.Y - e.Y)
'Then we set the new autoscroll position.
'ALWAYS pass positive integers to the panels autoScrollPosition method
Panel2.AutoScrollPosition = _
New Drawing.Point((DeltaX - Panel2.AutoScrollPosition.X), _
(DeltaY - Panel2.AutoScrollPosition.Y))
End If
End Sub
Protected Overrides Sub DefWndProc(ByRef m As Message)
If m.Msg <> 131 Then
MyBase.DefWndProc(m)
End If
End Sub