Autosize Image in Picture Box
c#, image
Solution
Take a look at the `SizeMode` property of the `PictureBox`: http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.sizemode.aspx
Set this to `AutoSize` and you're ready to go.
Check here what you can set it to
Problem
I'm doing an imageviewer. I've already done importing the image in the picture box. Which code should be used to autosize the image in the picture box? Here's my code in Viewing the image in picture box. ``` private void button1_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Multiselect = true; openFileDialog.Filter = "JPEG|*.jpg|Bitmaps|*.bmp"; if (openFileDialog.ShowDialog() == DialogResult.OK) { pFileNames = openFileDialog.FileNames; pCurrentImage = 0; ImageView(); } } protected void ImageView() { if (pCurrentImage >= 0 && pCurrentImage <= pFileNames.Length - 1) { pictureBox1.Image = Bitmap.FromFile(pFileNames[pCurrentImage]); } } ```