473,725 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PictureBox Scrolling

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

Oct 6 '07 #1
1 4730
bw****@gmail.co m wrote:
[...]
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.
[...]

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 AutoScrollPosit ion property of
the Panel.

Pete
Oct 6 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2458
by: Scott M | last post by:
Hi, I am writing a small game that is using a form 800 * 600. The form can be scrolled vertically up to a height of 1200 (basically the form can be scrolled down one screen vertically). The user controls a picturebox (my sprite) with the cursor keys When the sprite hits the y value of 600 the screen scrolls down to display the bottom part of the screen (by focusing on a hidden
0
3221
by: Paul Loveless | last post by:
Hi all. I have a user control that contains a picturebox within a panel with the panel set to autoscroll the picturebox. One thing that I have noticed with the default functionality is when you click and drag the scroll box (thumb track) the picturebox does not scroll until you release it. Is there a way to scroll the picturebox while you move the scrollbox (like when you scroll a web page)? Or do you have to use the scroll bar controls...
5
5791
by: Sharon | last post by:
I’m writing a Windows application. In the form I have a Panel and inside the panel I have a PictureBox control. I’m loading the PictureBox control with BMP image that has the following criteria: 14174 x 7874 Pixels (111.61MPixels), 1 BitsPerPixel, 3200x3200 DPI, No Compression. The memory consumption for loading this image should be 13.31 MB (13,952,776 Bytes) (this is what IrfanView takes, http://www.irfanview.com/). I’m loading...
0
3166
by: 6tc1 | last post by:
Hi all, I've got a UserControl that contains a few PictureBox objects. If I click on outside of the Picture in the UserControl, the scrolling with the mouse button works - however, no amount of clicking on the PictureBox objects will get that scrolling working. However, after I click on outside of the PictureBox object, then click as many times as I like on the PictureBox the scrolling with the mouse wheel continues to work. I found...
8
10466
by: Yogiman | last post by:
Hi Can anybody tell me how would I attach scrollbars to a picturebox ? The example given in MSDN is pretty good.But I have a different problem. I have to do other stuff with the picturebox as well like moving it, rotating it. Therefore, a solution with two pictureboxes (like the one given in MSDN) is of no use to me.Thanks in advance.
4
1657
by: MJ | last post by:
as topic, anyone can provide some codes that enable a scroll bar to a picturebox when the picture expand?
3
63433
by: Tom | last post by:
I have a picturebox on my VB.NET form. The picturebox size mode is set to stretched. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and display (in the status bar) the image coordinates of the mouse location. However, if I use the picturebox's MouseMove event, I am getting the coordinates of the mouse over the PICTUREBOX, not the actual image underneath that (which is stretched)....
4
12894
by: midicad2001 | last post by:
I have been researching this issue and have come across a number of solutions apparently written for VB5 or 6 and don't work under .NET, yes folks that is progress! Someone in this ng suggested just drop your picturebox into a panel with autoscroll=TRUE. I am wondering if this will work for my desired application - see details.
1
2566
by: The Confessor | last post by:
I'm trying to develop a graphically-simple, gameplay-complex RPG, and I decided to create a graphical Proof of Concept just to confirm that graphics would be... well, simple. Predictably, they've proven otherwise. This is my PictureBoxMap_Paint() Sub, which a tiles a PictureBox with 19* 17 40*40-pixel images, two rows and two columns of which are painted beyond the current bounds of the picturebox to facilitate scrolling. The If/Else...
0
1217
by: swagatikasahoo | last post by:
how to display all lines if i will scroll the picturebox. hi, ok i m sending the code. ****************************************************** Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint eGraphics = e.Graphics TryToCreateRec(eGraphics) PictureBox1.Refresh() End Sub Public Sub TryToCreateRec(ByVal eGraphics As Graphics) Dim blackPen As New Pen(Color.White,...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8096
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4517
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.