title: Trying to print DataGrid View with colored cell backgrounds
body: <p>I am using a freeware script to print DataGrid View but the problem I am facing is that although I have colored the cells, when I pass my DataGrid to the PrintDGV freeware code, it doesn't print the colors. I am not familiar with VB.NET or DataGrids so this is my first time trying to attempt this. </p>
  
  <p><strong>Image of how it currently looks in Print View:</strong>
  <img src="https://i.stack.imgur.com/FQDxS.png" alt="enter image description here"></p>
  
  <p><strong>Code:</strong></p>
  
  <p><a href="http://pastebin.com/0yjvmAp7" rel="nofollow noreferrer">http://pastebin.com/0yjvmAp7</a></p>
  
  <p>Initially I thought that I could just color my DataGrid's cells and pass it to the freeware to print and the freeware would print the background colors too but it seems that isn't true..</p>
  
  <p>Not sure if this is it but here you go:</p>
  
  <pre><code>Imports System.Collections.Generic
  
  ' Print Current Schedule Grid Form
  ' This form displays a list of the print options.
  ' When you press "OK", control is returned to the Officer Availability window where the specs are read and the actual printing is done.
  ' You can choose to limit the number of columns, from the Officer area, that are printed
  ' You can also choose to limit the # rows that are printed to the range selected in schedule.
  
  Public Class PrintOptions
  
      ' Form Events
  
      Public Sub New(ByVal availableFields As List(Of String))
  
          InitializeComponent()
  
          ' Add all of the displayed Officer specification columns to the columns available to be printed
          For Each field As String In availableFields
              chklst.Items.Add(field, True)
          Next
  
      End Sub
  
      Private Sub PrintOptions_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
          ' Set the Print Defaults - Print all rows by default and fit calendar to page width by default
  
          rdoAllRows.Checked = True
          chkFitToPageWidth.Checked = False
      End Sub
  
      ' Form Butten Events
  
      Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
          Me.DialogResult = Windows.Forms.DialogResult.OK
          Me.Close()
      End Sub
  
      Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
          Me.DialogResult = Windows.Forms.DialogResult.Cancel
          Me.Close()
      End Sub
  
      ' Read Form Properties
  
      Public Function GetSelectedColumns() As List(Of String)
          ' Scroll through the list of available columns and return a list of the columns to be printed
          Dim lst As New List(Of String)
          For Each item As Object In chklst.CheckedItems
              lst.Add(item.ToString)
          Next
          Return lst
      End Function
  
      Public ReadOnly Property PrintTitle() As String
          ' Return the title to be used when printing
          Get
              Return txtTitle.Text
          End Get
      End Property
  
      Public ReadOnly Property PrintAllRows() As Boolean
          ' Are all rows to be printed or should only the rows selected on the Grid in the Officer Availability window be printed
          Get
              Return rdoAllRows.Checked
          End Get
      End Property
  
      Public ReadOnly Property FitToPageWidth() As Boolean
          ' Compress grid width to fit on page
          Get
              Return chkFitToPageWidth.Checked
          End Get
      End Property
  
  End Class
  </code></pre>