From: Rich P on 12 Mar 2010 15:20 I have a PictureBox on a panel on a form. I have set the form's autoscroll = true and I have set the panel's autoscroll = true. I cycle through a list of pictures which display in the PictureBox, but when I show a picture which is larger than the current panel size I need to display scroll bars. But no scrollbars display. How do I make the panel scrollbars display when I reach an oversized picture? PictureBox sizemode = Normal, docking in panel is set to fill. Thanks Rich *** Sent via Developersdex http://www.developersdex.com ***
From: Rich P on 12 Mar 2010 15:33 I tried setting the sizemode of the picturebox to "autosize", but then I got an crossthread error message -- I am running the viewer in a while loop and using a backgroundworker. Here is the error I get when I try to use autosize on the picturebox sizemode Cross-thread operation not valid: Control 'picImage' accessed from a thread other than the thread it was created on. In the error message it gave a link on how to work with cross threading -- the article suggests to use a background work. I am already using a background worker. Rich *** Sent via Developersdex http://www.developersdex.com ***
From: Rich P on 12 Mar 2010 16:13 I fixed the crossthread error by moving the picturebox loading from BackgroundWorkder_DoWork to BackgroundWorker_ProgressChanged(...). Now I can at least use the AutoSize mode of the picture box, but still no scroll bars. I need scrollbars (more than I need a cow bell :). Rich *** Sent via Developersdex http://www.developersdex.com ***
From: Rich P on 12 Mar 2010 16:56 Yay! I got my dumb scrollbars! Here is what I did - I deleted the original picturebox, deleted the containing panel, readded the panel and dock = fill (under another panel, set autoscroll=true. Re-add a picturebox, set sizemode to autosize, not docked, positioned at top left cornver of containing panel. Now my oversized pictures activate the scrollbars. My next challenge will be dragging an oversized picture around inside the panel. Rich *** Sent via Developersdex http://www.developersdex.com ***
From: Joe Cool on 12 Mar 2010 17:03 On Mar 12, 4:56 pm, Rich P <rpng...(a)aol.com> wrote: > Yay! I got my dumb scrollbars! Here is what I did - I deleted the > original picturebox, deleted the containing panel, readded the panel and > dock = fill (under another panel, set autoscroll=true. Re-add a > picturebox, set sizemode to autosize, not docked, positioned at top left > cornver of containing panel. Now my oversized pictures activate the > scrollbars. > > My next challenge will be dragging an oversized picture around inside > the panel. > I am curious, are the scrollbars part of the Panel control or the PictureBox control?
|
Next
|
Last
Pages: 1 2 Prev: PictureBox on a Panel -- display scrollbars for large pics? Next: I solved this problem |