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

Posted on 2009-02-16
Medium Priority
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
  • 3
  • 2
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 23656058
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

ID: 23656569
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 86

Accepted Solution

Mike Tomlinson earned 2000 total points
ID: 23661321
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

ID: 23666880
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

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

840 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