Sign in to follow this  
Followers 0
ShelbySue

Image Pan

2 posts in this topic

I am attempting to simulate a image zoom by displaying the image in a window smaller than the image and offsetting the left, right to be negative. This gives the impression I am only looking at a portion of the image.

I am currently panning using this code:

case $msg = $but4; move image left
                $s = $currentx
                $currentx += $xoffset
                if $currentx > $left  then $currentx = $left; if moved too far, correct
                if $s <> $currentx then ; if actually moved
                ; delete current control, then create a new one to simulate move
                    GUIctrlDelete($pic_1)  
                    $Pic_1 = GuiCtrlCreatePic($p1, $currentX ,$currenty, 0, 0)
                EndIf
            
        case $msg = $but3; move image right
                $s = $currentx
                $currentx -= $xoffset
                if $currentx > 0   then $currentx = 0; if moved too far, correct
                if $s <> $currentx then ; if actually moved
                ; delete current control, then create a new one to simulate move
                    GUIctrlDelete($pic_1)
                    $Pic_1 = GuiCtrlCreatePic($p1, $currentX ,$currenty, 0, 0)
                EndIf

Is there a smoother way to move an image around. I am using buttons. Currently the image disappears and redraws in the position desired, but that redraw is horribly inconvenient. In my application, the user clicks on a smaller version of the image to "magnify" to that point. That works fine I just can't figure out how the panning can be smoother.

Joe Phillips

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0