|
-
Dec 19th, 2006, 10:06 AM
#1
Thread Starter
Junior Member
Pan an Image
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:
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
-
Dec 20th, 2006, 02:14 AM
#2
Frenzied Member
Re: Pan an Image
Hi,
take a look here - there is code to pan and zoom
Pete
-
Dec 20th, 2006, 09:13 AM
#3
Thread Starter
Junior Member
Re: Pan an Image
Thank you very much for your reply.
Unfortunately even with your code my picturebox is still resisting and doesn't want to scroll.
Somehow it seems as the scrollbars don't know where they belong to. Or none of the controls now which size the map actually has. I put the scrollbars on top of the picturebox. But even if I scroll directly nothing happens.
Is there any way to tell the scrollbars directly where they belong? Which sizemode should the pictureBox have? Are there any other property settings I should be aware of?
Cheers
Conny
-
Dec 21st, 2006, 03:18 AM
#4
Frenzied Member
Re: Pan an Image
did you
Put a large picture box and a horizontal and vertical scroll bar on your form
If so the code should work. What device is this running on - is it qvga (320*240) of vga (640*480)
Pete
-
Dec 21st, 2006, 04:31 AM
#5
Thread Starter
Junior Member
Re: Pan an Image
It's a qvga device.
Well, I can't make the picturebox, and the container panel respectively, to big, because I have to put some other controls under it. It's going to be a navigation application, so you have the map in the upper part and some labels like Speed in the lower part.
I've got one form and put a panel on this form which fills the whole screen. In this panel I out a second panel which is maybe two third of the screen and is the container for the map.
-
Dec 21st, 2006, 04:43 PM
#6
Frenzied Member
Re: Pan an Image
Hi,
shouldn't be a problem - just put the scroll bars on the 'picture panel'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|