title: C# - Changing SizeMode of picturebox
body: <pre><code>    private void button1_Click(object sender, EventArgs e)
      {
          OpenFileDialog open = new OpenFileDialog();
          open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.png; *.bmp)|*.jpg; *.jpeg; *.gif; *.png; *.bmp";
          if(open.ShowDialog() == DialogResult.OK)
          {
              tbFileName.Text = open.FileName;
              pictureBox1.Image = new Bitmap(open.FileName);
          }
      }
  </code></pre>
  
  <p>So I want to make an if statement, if the image is too big for the initial size of the image box (520, 301), set the image box sizemode to autosize, otherwise just put it in there.</p>
  
  <p>I'm pretty sure that you can change it by using this:</p>
  
  <pre><code>picturebox1.SizeMode = PictureBoxSizeMode.AutoSize;
  </code></pre>
  
  <p>But I don't know how to write the if statement.</p>