Reputation: 401
I want that when i resize the form, Image Display resize with form size automatically
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp; *.png";
if(openFileDialog1.ShowDialog() == DialogResult.OK){
pictureBox1.ImageLocation = openFileDialog1.FileName;
//pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
}
}
Suggest me some code please
Upvotes: 0
Views: 1119
Reputation: 63105
try
pictureBox1.Dock = DockStyle.Fill;
and
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
Edit
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
Upvotes: 2