Click here to Skip to main content
12,249,797 members (51,435 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
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 19-Sep-12 3:33am
Comments
Wes Aday 19-Sep-12 9:41am
   
If you are resizing the picturebox, why can't you set the width and height?
Manfred R. Bihy 19-Sep-12 10:24am
   
My thoughts exactly!
Wes Aday 19-Sep-12 11:03am
   
Can't for the life of me figure out how this is a problem....

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  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
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 19 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100