Conny3
Dec 19th, 2006, 09:06 AM
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.
Private clickPosn As Point
Private scrollPosn As Point
Public Sub picBoxMap_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles picBoxMap.MouseDown
clickPosn.X = e.X
clickPosn.Y = e.Y
End Sub 'picBoxMap_MouseDown
Public Sub picBoxMap_MouseMove1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles picBoxMap.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
scrollPosn.X = clickPosn.X - e.X
scrollPosn.Y = clickPosn.X - e.Y
'übergabe der veränderten pos. an Scrollbar
'dadurch veränderung des bildausschnitts
pnlBoxMap.AutoScrollPosition = scrollPosn
End If
End Sub 'picBoxMap_MouseMove
Does anyone here know what I'm doing wrong? I use visual studio 2005 and cf2.0
Cheers
Conny
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.
Private clickPosn As Point
Private scrollPosn As Point
Public Sub picBoxMap_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles picBoxMap.MouseDown
clickPosn.X = e.X
clickPosn.Y = e.Y
End Sub 'picBoxMap_MouseDown
Public Sub picBoxMap_MouseMove1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles picBoxMap.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
scrollPosn.X = clickPosn.X - e.X
scrollPosn.Y = clickPosn.X - e.Y
'übergabe der veränderten pos. an Scrollbar
'dadurch veränderung des bildausschnitts
pnlBoxMap.AutoScrollPosition = scrollPosn
End If
End Sub 'picBoxMap_MouseMove
Does anyone here know what I'm doing wrong? I use visual studio 2005 and cf2.0
Cheers
Conny