PictureBox

P

Pums

I am writing a code to resize an image to fit in the
picturebox so that the length/ height ratio of the image
remains same. so, i have written one function to resize
image and in that function initially i am always
restoring the picturebox size initially.

Now the problem is every time i want to resize the
picturebox in design time it's calling that function and
so, it doesn't get resized.

So, how should i solve this? so, that when image is
changes then only resize picturebox is called, not when
the image is null or same.
 
B

Bob Powell [MVP]

First of all, don't bother wih PictureBox. It has baggage you don't need.

Derive a control directly from Control and see the GDI+ FAQ article on how
to display an image with the original aspect ratio for the draw code.

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

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

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

Read my Blog at http://bobpowelldotnet.blogspot.com
 

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