Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ScrollBar and PictureBoxes

Status
Not open for further replies.

jlipsitz

Programmer
Jul 13, 2003
14
US
Hi

I have a panel with several pictureboxes on it. I need to be able to scroll the panel in order to see all of the pictures. To do this I am using autoscroll and setting it to true. I am also capturing mousewheel events to zoom in/out on the pictures. However, when the scrollbar is visible it too captures the mousewheel and scrolls the panel left or right. Is there anyway I can get around this so that only the mousewheel events effect the pictureboxes and to scroll the user would physically have to move the scrollbar?

Thanks
 
you may aswell scroll manually for what it's worth. it's only a few lines of code..

private void hScrollBar1_Scroll(object sender, System.Windows.Forms.ScrollEventArgs e){
panel1.Location = new Point(-hScrollBar1.Value, panel1.Location.Y);
}

private void vScrollBar1_Scroll(object sender, System.Windows.Forms.ScrollEventArgs e){
panel1.Location = new Point(panel1.Location.X, -vScrollBar1.Value);
}

..which leaves you free to diddle with the scroll wheel as you see fit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top