Hiya,

I'm struggling with a function to pan/scroll an image, in this case, a map. I put the picturebox into a panel and want to pan with the help of the panel.autoscroll function but it doesen't work and I don't have a clue why.

VB Code:
  1. Private clickPosn As Point
  2. Private scrollPosn As Point
  3.  
  4. Public Sub picBoxMap_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles picBoxMap.MouseDown
  5.         clickPosn.X = e.X
  6.         clickPosn.Y = e.Y
  7. End Sub 'picBoxMap_MouseDown
  8.  
  9. Public Sub picBoxMap_MouseMove1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles picBoxMap.MouseMove
  10. If e.Button = Windows.Forms.MouseButtons.Left Then
  11.             scrollPosn.X = clickPosn.X - e.X
  12.             scrollPosn.Y = clickPosn.X - e.Y
  13.             'übergabe der veränderten pos. an Scrollbar
  14.             'dadurch veränderung des bildausschnitts
  15.             pnlBoxMap.AutoScrollPosition = scrollPosn
  16.  
  17.         End If
  18. End Sub 'picBoxMap_MouseMove

Does anyone here know what I'm doing wrong? I use visual studio 2005 and cf2.0

Cheers
Conny