Click here to Skip to main content
15,666,373 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey everyone, a new guy here in C#.Net.

What I need is to zoom an image drawn using gdi+ to pictureBox.

I searched but couldn't find a nice answer, all I found was for existing files.
Does anyone has an idea?

Thanks for the answers.

My best Regards...

Hope this[^] might help you.
Share this answer
Un_NaMeD 19-May-11 5:41am    
I had a quick look on the thread. It might help, but not the way I need. First, it's Vb.Net. Second, it's using existing files.
Thanks anyway for the time you spend :)
You can draw the image after your GDI operations on the device context. So the image will be scaled accordingly.

here is an example

Have an Image fit to picturebox, zoom and move[^]

It draws the image after transforming the device context.

Good luck
Share this answer
You may or may not use PictureBox in this case, depending on your other functions.
Anyway, you can get any functionality without PictureBox, but not visa versa, so you should at least consider the alternative:

Please see my recent answer here:
C# Opacity Of Picturebox[^].

Good luck,
Share this answer
Un_NaMeD 19-May-11 16:04pm    
Hi SAKryukov.
I searched many of your posts, and you really are a great adviser, but you're generally giving your advices with sentences(Or I'm wrong, because haven't seen any code of yours).
For example, you say instead of using PictureBox, use Controls, Onpaint/Paint events. it's fine, but sometimes useless without codes or examples.(for me at least)
Anyway, thanks for reply...
Sergey Alexandrovich Kryukov 20-May-11 17:04pm    
Thank you for your note, but not that I can help it.
It's not the situation where we just work for you, resources are limited; and you're supposed to do you work share. As to replacement of PictureBox, I have absolutely useful and detailed instructions. You can do you it without sample code. You just need to go be references.

You're supposed to collaborate and help me helping you. If you have a follow-up question, ask it.

In your case replacement of PictureBox can be very useful, but may not make dramatic difference. As I say "may or may not".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900