Archived

This topic is now archived and is closed to further replies.

Hippokrates

Scrolling an Image in C#

Recommended Posts

Hippokrates    122
I am currently trying to write a small application using C#. Since I would like to display quite large images on my form I need to know: 1) Which control I have to use to display the image 2) How to add scrollbars to it 3) How to scroll the Image.

Share this post


Link to post
Share on other sites
Hippokrates    122
Well, I tried that one but could''nt convince it not to either scale the image to the size of the control or to scale the control to the size of the image...

Share this post


Link to post
Share on other sites
flangazor    516
Apologies for posting a "i dunno but.."

It may be that you need to make a new control that is a scrollable frame that holds a picture box. That is how I would do it using Swing, Qt, VB6, and Tk.

I don't use .Net though.

[edited by - flangazor on May 29, 2003 10:51:38 AM]

Share this post


Link to post
Share on other sites
Arild Fines    968
What flangazor says makes sense. Derive your own control from ScrollableControl and do the rendering of the image yourself in the OnPaint method.



AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster

duh... set the SizeMode Property to what you want it to be like... stretching, autosize, whatever.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Another way is to put a Panel on the form, and set its autoscroll property to true, then put the picture box inside the panel and make the picture box as big as you want, and that should let you scroll around it if its size is set to bigger than the size of the Panel

Share this post


Link to post
Share on other sites