zoom pictures

H

harry

Hello everybody.

I want to do simple image viewer. I want to provide zoom functionality.
I have done this, by changing PictureBox control dimesions. But this
solution isn't good.
Can we put into picuterbox fragment of our picture and don't change
dimensions of the picutrebox.

May you tell me, how can i do this and where can i found informations about
this. ( simple project etc.)?

thanks
Chris
 
B

Bob Powell [MVP]

You would probably be better off ignoring PictureBox entirely and creating a
custom control that does zoomed drawing.

A simple control with an Image property and an overidden OnPaint method can
do everything that Picturebox can do anyway. Once you have control over the
drawing process you can use the Matrix class to create zooming and panning.

The simplest would be to derive from ScrollableControl and add zooming and
panning capabilities from there.

This is definitely a FAQ item so I'll put something in the Windows Forms
Tips ad Tricks pages to explain.

I suggest you subscribe to the RSS feed on that page.

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

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top