Panel1 scroll bars ... Hide them but still be able to scroll my image that is in Picturebox

Posted on 2009-02-16
Last Modified: 2012-05-06
I use VB 2008 Express

What I have and what I need

Panel called Panel1
Picturebox called PictureBox1

Picturebox1 is within Panel1 ...... Picturebox1 contains a map image of which I can grab an scroll the image like you can in Google Maps
I want to do 2 things

1.  I want the scroll bars that are showing to not show .... so that I can still scroll by grabing the image of which I already have the code in place to do I just want the scroll bars gone ... is there an override that will tell the panel not to draw them?

2. I want to click on spot and the image in the picturebox1 that is in the panel1 scroll to clicked position

Question by:vbMarkO
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    It really depends on how you are currrently allowing the user to "pan" the image.  Have you tried setting the Panels AutoScroll() Property to False?

    Author Comment

    Well here is a glimps of how they are doing it .....

    Maybe this will tell you enough
    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
                Panel1.AutoScrollPosition = _
                New Drawing.Point((DeltaX - Panel1.AutoScrollPosition.X), _
                (DeltaY - Panel1.AutoScrollPosition.Y))
            End If

    Open in new window

    LVL 85

    Accepted Solution

    You are setting the AutoScrollPosition to move the Image so you can't turn off the SrollBars.

    If you want to be able to move it without scrollbars then you'll need to write custom code to manually adjust the Location() Property of your PictureBox as the mouse is moved....

    Author Comment

    Ok, I could possibly live with the scrolls but 2nd part is how about user clicking on spot and the image center or scroll to the clicked position like in google    ... you click on a on image and the image centers on the new position

    Anythoughts ....


    Author Closing Comment

    Going to live with the scroll bars for now ... thanx for the info

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now