autosize an image for a pictureBox's size

A

Al

I'm using visual C# 2005 Express Edition and I would like to open the
image in the picture box, without make the picture box larger. For the
moment, the code is:
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
Image img = Image.FromStream(openFileDialog1.OpenFile());
pictureBox1.Image = img;
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
//but this only modifies the size of the pictureBox
}
 
G

Guest

pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;

Use a different PictureBoxSizeMode. The one you want is probably
PictureBoxSizeMode.Zooom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top