By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,034 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,034 IT Pros & Developers. It's quick & easy.

Image Viewer ...

P: n/a
Hi all

I need to do a image viewer, just to view and zoom pictures
in jpeg. I do not need to edit or save the picture.

I am sure, there are some controls already made.
I am thankful for any comment on that !

Best regards
Frank Uray
Dec 7 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hello Frank,

You need to use GDI+ for this.
Use MSDN for more info and google to find samples how to use it
http://www.c-sharpcorner.com/UploadF.../gdi_plus.aspx

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
FUHi all
FU>
FUI need to do a image viewer, just to view and zoom pictures in jpeg.
FUI do not need to edit or save the picture.
FU>
FUI am sure, there are some controls already made.
FUI am thankful for any comment on that !
FUBest regards
FUFrank Uray
Dec 7 '07 #2

P: n/a
On Dec 7, 6:43 am, Frank Uray <FrankU...@discussions.microsoft.com>
wrote:
Hi all

I need to do a image viewer, just to view and zoom pictures
in jpeg. I do not need to edit or save the picture.

I am sure, there are some controls already made.
I am thankful for any comment on that !
I would recommend doing research into the System.Drawing Image Class:

http://msdn2.microsoft.com/en-us/lib...ing.image.aspx

And into the System.Windows.Forms PictureBox control:

http://msdn2.microsoft.com/en-us/lib...icturebox.aspx

The PictureBox control has an Image property that works exactly like
the Image Class. Pay particular attention to the PictureBox SizeMode
property.

There is no builtin .NET code to do zooming, but it can be
accomplished by setting the Top and Left properties of the picturebox
to be outside of the form.

Dec 7 '07 #3

P: n/a
On Dec 7, 9:25 am, za...@construction-imaging.com wrote:
On Dec 7, 6:43 am, Frank Uray <FrankU...@discussions.microsoft.com>
wrote:
Hi all
I need to do a image viewer, just to view and zoom pictures
in jpeg. I do not need to edit or save the picture.
I am sure, there are some controls already made.
I am thankful for any comment on that !

I would recommend doing research into the System.Drawing Image Class:

http://msdn2.microsoft.com/en-us/lib...ing.image.aspx

And into the System.Windows.Forms PictureBox control:

http://msdn2.microsoft.com/en-us/lib....forms.picture...

The PictureBox control has an Image property that works exactly like
the Image Class. Pay particular attention to the PictureBox SizeMode
property.

There is no builtin .NET code to do zooming, but it can be
accomplished by setting the Top and Left properties of the picturebox
to be outside of the form.
Let me add something. One of the valid values for the
PictureBox.SizeMode property is Zoom which will make images larger on
the screen, but only within the confines of the picturebox control
that contains the image. If you want to magnify it more, you will need
to do the technique I mentioned earlier.

The difference between SizeMode Zoom and SizeMode Stretch is that Zoom
maintains the image's aspect ratio, Stretch does not.
Dec 7 '07 #4

P: n/a
On Fri, 07 Dec 2007 06:25:55 -0800, <za***@construction-imaging.comwrote:
[...]
There is no builtin .NET code to do zooming, but it can be
accomplished by setting the Top and Left properties of the picturebox
to be outside of the form.
I think I would call that "panning". :)

The PictureBox does offer some minimal control over basic zooming
behavior. For anything more complicated than that, a custom control would
be required. Based on what little I know about WPF, using WPF is probably
the easiest way. But it wouldn't be hard to write a custom control that
handles it either.

Drawing oneself, you would presumably be using the Graphics.DrawImage()
method to draw the bitmap on the screen, in the form. To scale (zoom)
and/or offset (pan) the drawing, you can simply provide destination
dimensions for the image that are different from the source dimensions
(zoom in, dimensions are larger, zoom out, smaller...pan down and/or
right, origin of destination is to the left or up from the visible origin
in the control, and vice a versa). Alternatively, one can modify the
effective viewport being used to draw by creating a new transformation
matrix and assigning it to the Transform property of the Graphics instance
being used to draw.

Of course, you also need to provide a UI to control zoom and pan. That's
an entirely separate matter. But a standard click-and-drag or
scrollbar-based UI is fairly straightforward.

Pete
Dec 7 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.