title: Changing Appearance of Null / Empty Image on DataGridView
body: <p>I havea WinForms application with several datagridviews.  On one of them I have a column which dynamically populates with images.  I have included a screenshot below:</p>
  
  <p><img src="https://i.stack.imgur.com/nklnT.png" alt="Screenshot"></p>
  
  <p>Many of the cells do not meet the requirements to generate an image and so appear empty.  However, when this happens the application shows the default red X for no image.  I want the cells to simply appear empty rather than show this default image.</p>
  
  <p>I have tried creating a blank image, but this causes its own issue; namely, because my datagridview has alternating row back colors, a white image shows up against grey rows, and vice versa.  </p>
  
  <p>In effect I want a null / empty or transparent image, that simply does not show at all in the column, when the run time requirements for one of the other images are not met.</p>
  
  <p>For completeness the code I am using at the moment is as follows:</p>
  
  <pre><code>foreach (DataGridViewRow row in dataCaseHistory.Rows)
  {                    
      DataGridViewCell cell = row.Cells["DocID"];
      if (cell.Value.ToString().Length &gt; 0)
      {
          if (((int)cell.Value) % 2 == 0)
          {
              row.Cells["Doc"].Value = (System.Drawing.Image)Properties.Resources.Paperclip___done;
          }
          else
          {
              row.Cells["Doc"].Value = (System.Drawing.Image)Properties.Resources.Bundle___done;
          }
      }
      else
      {
           row.Cells["Doc"].Value = null;
      }
  }
  </code></pre>
  
  <p>The logic tests to select the image is temporary.  I'm just trying to set things up before applying the real, more involved criteria for image selection.</p>