473,387 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

control scroll without window scroll

Hi,
I programmed a windows forms application. it contains several pictureBoxes, each showing the first picture in a folder. When the mouse is over the pictureBox and you turn your mousewheel, it shows the next/prev picture.

This works fine. The picturebox is getting focus when the mouse enters and the picture changes with the wheel.

But the window is scrolling, too.

How can i prevent the window scroll when one of the pictureBoxes has focus?
Sep 4 '09 #1
4 2936
tlhintoq
3,525 Expert 2GB
You could change the display mode to 'zoom' so the entire image fits in the PictureBox; then there is nothing to scroll.
Sep 4 '09 #2
I use Zoom already. It's not that I want to scroll the image. I use the mousewheel to go to the next/prev image in that folder.

I have a folder with (let's say) 100 subfolders containing pictures. for each subfolder there is a picturebox (400x400 Pixels) showing the first picture in the subfolder. When I move the mouse onto the picture and use the wheel I want it to show the next or the previous picture.
It does that, but it scrolls the the main window up or down, too. And the is what I want to prevent.
Sep 4 '09 #3
tlhintoq
3,525 Expert 2GB
It does that, but it scrolls the the main window up or down, too. And the is what I want to prevent.
Oh... the main window. I thought it was scrolling the newly placed image in the PictureWindow. My mistake.

Have you tried putting a handler in the main window as an override of the scroll?

You may want to have a bool that changes when you go in and out of the picturebox. When in the picture box the main window handler does not call the base.scroll. When NOT in the picturebox is does call the base.scroll so the window behaves normally.

I haven't tested this personally but think it should work.
Sep 4 '09 #4
Thank you it worked just fine.
I had to put a bool in both the main window and the picturebox, because the picturebox wouldn't lose focus when the mouse leaves.

thanks again.
Sep 4 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Noozer | last post by:
I am able to place values on forms that load into my webbrowser control, but I'd like to be able to scan the page for data. I know to use the HTMLDocument object. Basically I'm hoping to find an...
3
by: Nilesh | last post by:
Hi, In my application i need to create the controls at runtime and also need to position them. I am doing it by this like, control.Location = new Point(x,y); Now when i am getting lets say y...
0
by: msnews.microsoft.com | last post by:
Hello, I am trying to remove the scrollbars from any page I load up into the browser control on a window form. I first tried the following: browserDoc = (mshtml.HTMLDocument)browser.Document;...
0
by: Kenneth H. Brannigan | last post by:
Hello, I am trying to remove the scrollbars from any page I load up into the browser control on a window form. I first tried the following: browserDoc = (mshtml.HTMLDocument)browser.Document;...
2
by: usenet | last post by:
When I open a form design window in Access 2003 it *always* has scroll bars, this is even when the form itself is tiny. It's as if the 'page' on which the form is being designed is very large. ...
2
by: Paul E Collins | last post by:
I'm writing an application whose main window consists of a particular UserControl that I have placed inside a docked Panel so that it will fill the whole window. The panel also has the AutoScroll...
5
by: Dinsdale | last post by:
I have an application that recieves text data via external input (i.e. serial) and displays it on the screen (we use carraige return as a delimiter). At this point I use a regular old text box and...
3
by: =?Utf-8?B?Qw==?= | last post by:
Hi, I have a user control which I use on all my pages. The control is situated on the top of my page (sits on my master page). For some long pages the user has to scroll back up to the top of...
4
by: stuckagain | last post by:
Hi, I have a page with a scrollable DIV, and within that DIV, I have a few asp.net menu controls. The idea being, the user mouses over the small icons and is presented with a list of options. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.