• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 955
  • Last Modified:

Scale image to fit picture box?

Hello expert, i am using visual studio 2008 picture box control to load images from our database.  The problem is some of the images are too large, to fit in the picturebox and since this application will be running on a touch screen computer, i dont want to use scrollbars.  I was wondering how i could size the images to fit in the picturebox?  The resolution doesnt have to be perfect, it would just be nice if the image wasnt getting cut off.  Any ideas?
0
tentavarious
Asked:
tentavarious
1 Solution
 
wdosanjosCommented:
Try setting PictureBox.SizeMode = PictureBoxSizeMode.Zoom.  The Height and Width must be set for it to work properly.

http://msdn.microsoft.com/en-us/library/system.windows.forms.pictureboxsizemode.aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.sizemode.aspx
0
 
HainKurtSr. System AnalystCommented:
0
 
Mohamed AbowardaSoftware EngineerCommented:
Change the picture box size mode to stretch image:
pictureBox.SizeMode = PictureBoxSizeMode.StretchImage

Open in new window


Replace pictureBox to your picture box name.
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now