Click here to Skip to main content
15,896,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have searched over the web and i can't find an answer. How to resize a picture box to fit an image that loads a user?
Posted
Comments
[no name] 19-Sep-12 9:41am    
If you are resizing the picturebox, why can't you set the width and height?
Manfred Rudolf Bihy 19-Sep-12 10:24am    
My thoughts exactly!
[no name] 19-Sep-12 11:03am    
Can't for the life of me figure out how this is a problem....

1 solution


  1. Get an Image[^] loaded, maybe using Image.FromFile(String path)
  2. Use the Size property[^] of that loaded Image to get the dimensions in pixel
  3. Use your PictureBox's[^] Height and Width property to set the correct height and width you retrieved from the previous step.


Regards,

— Manfred
 
Share this answer
 

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