Image control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to have a control that I can place on a form that I can view an Image.
But here's the catch, I need to view the entire image (no matter the size)
in a 400x400 pixel object. Also, I need to be able to to enlarge and shrink
the image in the same viewable area. Is there any .Net object that does
something similar to this or do I need to enhance an existing object such as
the PictureBox?

thx...sonny
 
I need to have a control that I can place on a form that I can view an Image.
But here's the catch, I need to view the entire image (no matter the size)
in a 400x400 pixel object. Also, I need to be able to to enlarge and shrink
the image in the same viewable area. Is there any .Net object that does
something similar to this or do I need to enhance an existing object such as
the PictureBox?

thx...sonny

The PictureBox is the only control that has part of the functionality you seek (having AutoSize), however, you might be better off creating your own UserControl. Autosizing an image to fit is not so difficult, and you have more control than using a PictureBox.

I would be surprised if there aren't any free UserControls on the net doing this, although I'm not aware of any.
 
The PictureBox is the only control that has part of the functionality you
seek (having AutoSize), however, you might be better off creating your own
UserControl. Autosizing an image to fit is not so difficult, and you have
more control than using a PictureBox.
I would be surprised if there aren't any free UserControls on the net doing this, although I'm not aware of any.

That's what I was figuring. I was hoping that maybe there was a new control
in 3.0 or something that I didn't find in 2.0.

Oh well, thanks.
 
You may be inspired by the article on how to draw an image at a given
size while retaining the aspect ratio.

This is in the GDI+ FAQ.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Thanks Bob,

I haven't been working on the image control piece for a few days now. But
I'd like to thank you for your Zoom Image example. I used it in my proof of
concept application.

Is there another way of duplicating the viewing functionality of 'Windows
Picture and Fax Viewer' instead of using GDI+?
 
Back
Top