Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

PictureBox Scrolling

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bwilde@gmail.com - 06 Oct 2007 03:49 GMT
Hello,

Here's what I'd like to have in a form that I'm creating: A picture
box that contains an image that is significantly larger than the box.
I'd like for there to be scroll bars, but also to enable the user to
click and drag the image directly, with the scroll bars updating to
reflect which section of the image is shown on the screen.

I've created a panel and set it to AutoScroll, and put a PictureBox
into it.  When the scroll bars are used, things work perfectly.  When
I try to click and drag on the image (and update the Location of the
picture), the image moves as it should, but the scroll bars do not.
What happens is that the handles always stay in the same place, but
get wider or narrower as I change the .Location of the picture box.
Also, if I move the image to the upper left corner, the scroll bars
disappear completely, and if I move it to the bottom right, the scroll
bars have tiny scroll handles.

Any ideas of how to get this right?

Thanks,
Ben
Peter Duniho - 06 Oct 2007 04:34 GMT
> [...]
> I've created a panel and set it to AutoScroll, and put a PictureBox
[quoted text clipped - 4 lines]
>
> Any ideas of how to get this right?

Instead of changing the Location property of the PictureBox when the
user drags, you should be changing the AutoScrollPosition property of
the Panel.

Pete

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.