Click here to Skip to main content
15,891,708 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
hello everyone..
How can i resize a image to fit it to PictureBox in vb.net
plz suggest me..

Thanking You
Posted
Updated 17-Oct-16 1:18am

set image in BackgroundImage property of picture-box
then set picture-box's BackgroundImageLayout = stretch
thus Image will auto fit to size of picture-box.
Happy Coding!
:)
 
Share this answer
 
v3
You need to resize the image for the picture box height & width.
Its pretty straight forward.
Create a new Bitmap of size picture box height & width. Fill-in the new bitmap with the existing image.

There is a nice article which describes it.
Resizing an Image On-The-Fly using .NET
 
Share this answer
 
 
Share this answer
 
picboxname.sizemode=pictureboxsizemode.stretchimage
 
Share this answer
 
Comments
[no name] 17-Oct-16 7:22am    
Yeah... already said FOUR years ago. Good job.
I know it's late and whatnot, but just set the Size Mode for the PictureBox to "Zoom". This will automatically scale your image to fit your PictureBox, regardless if your image is larger or smaller than the box itself.
 
Share this answer
 
Comments
OriginalGriff 6-Jul-20 4:40am    
While I applaud your urge to help people, it's a good idea to stick to new questions, rather than 8 year old ones. After that amount of time, it's unlikely that the original poster is at all interested in the problem any more!
Answering old questions can be seen as rep-point hunting, which is a form of site abuse. The more trigger happy amongst us will start the process of banning you from the site if you aren't careful. Stick to new questions and you'll be fine.
Abraham Esguerra 6-Jul-20 23:21pm    
Oh, I see. Thank you for reminding me about this, I think I answered another one... I will try to remove that one.
OriginalGriff 7-Jul-20 2:01am    
You're welcome!

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