title: Change font size in a column in DataGridView
body: <p>I have a column in a DataGridView (WinForm application) that needs the font size and style changed. From the article here: <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.font.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.font.aspx</a> , I am thinking that the code below will get the result that I want (I am testing by changing the styling first):</p>
  
  <pre><code>this.dataGridViewMain.Columns[3].DefaultCellStyle.Font = new Font(dataGridViewMain.DefaultCellStyle.Font, FontStyle.Italic);
  </code></pre>
  
  <p>But the code does not change anything. I also tried to add the code on the <code>RowPostPaint</code> event handler but still does not work. I know the font that is used by the program is set on the <code>DataGridView.RowsDefaultCellStyle</code> properties but I thought placing code in the <code>RowPostPaint</code> event will override that. Below is the code from the <code>RowPostPaint</code> event:</p>
  
  <pre><code>void dataGridViewMain_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  {
      this.dataGridViewMain.Columns[3].DefaultCellStyle.BackColor = Color.Gray;
      foreach (DataGridViewRow row in this.dataGridViewMain.Rows)
      {
          int daysInShop = Convert.ToInt32(row.Cells["Days in the shop"].Value);
          if (daysInShop &gt; 4)
          {
              row.DefaultCellStyle.BackColor = Color.Red;
              row.DefaultCellStyle.ForeColor = Color.White;
          }
          else if (daysInShop &gt; 2)
          {
              row.DefaultCellStyle.BackColor = Color.Yellow;
          }
          else
          {
              row.DefaultCellStyle.BackColor = Color.YellowGreen;
          }
          row.Height = 35;
      }
  
      this.dataGridViewMain.CurrentCell = null; // no row is selected when DGV is displayed
  }
  </code></pre>
  
  <p>Any help is appreciated. Thanks.</p>