title: How to set rows' height to automatically resize so contents fit
body: <p>I'm working on DataGridView and was wondering if there's a property that automatically makes cells bigger if the content requires it.</p>
  
  <p>So far I have, at the end of the DataGridViewBindingComplete handler:</p>
  
  <pre><code>dataGridView1.AutoResizeRows(DataGridViewAutoSizeRowsMode.AllCells);
  </code></pre>
  
  <p>But unfortunately, that didn't do the trick.</p>
  
  <p>Here's what I tried so far:</p>
  
  <pre><code>public partial class Form1 : Form
  {
      private void dgv1BindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
      {
          dataGridView1.AutoResizeRows(DataGridViewAutoSizeRowsMode.AllCells);
      }
  
      public Form1()
      {
          InitializeComponent();
  
          // [...] set up datasource: orders
  
          dataGridView1.AutoGenerateColumns = false;
          dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
          dataGridView1.DataSource = orders;
  
          DataGridViewTextBoxColumn idCol = new DataGridViewTextBoxColumn();
          idCol.DataPropertyName = "id";
          idCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
          idCol.HeaderText = "#";
          idCol.DisplayIndex = 0;
  
          DataGridViewTextBoxColumn placedCol = new DataGridViewTextBoxColumn();
          placedCol.DataPropertyName = "placed";
          placedCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
          placedCol.HeaderText = "Time Placed";
          placedCol.DisplayIndex = 1;
  
          // [...] more of these columns
  
          dataGridView1.Columns.Add(idCol);
          dataGridView1.Columns.Add(placedCol);
          // [...] adding the rest of the columns
  
          dataGridView1.DataBindingComplete += dgv1BindingComplete;
      }
  }
  </code></pre>
  
  <p>With the following result:</p>
  
  <p><img src="https://i.stack.imgur.com/ZGPOP.png" alt="Orders description is on one line. Image cell is not enlarged."></p>