title: Calling the OnDrawColumnCell procedure Delphi DBGrid
body: <p>I have <code>DBGrid</code> which stores client information and the expiry dates of memberships. I am using the following code on the <code>OnDrawColumnCell</code> event of the <code>DBGrid</code> to color rows which include memberships which are expiring (teal) or expired (red):</p>
  
  <pre><code>procedure TfrmMain.grdMainDrawColumnCell(Sender: TObject; const Rect: TRect;
    DataCol: Integer; Column: TColumn; State: TGridDrawState);
  begin
    if (ADOMember.FieldByName('expirydate').AsDateTime &gt;= (now)) and (ADOMember.FieldByName('expirydate').AsDateTime &lt;= (now+7)) then
    begin
      grdMain.Canvas.Brush.Color := clTeal;
      grdMain.Canvas.Font.Color := clWhite;
      grdMain.DefaultDrawColumnCell(Rect, DataCol, Column, State);
    end;
    if (ADOMember.FieldByName('expirydate').AsDateTime &lt; (now)) and (ADOMember.FieldByName('expirydate').AsString &lt;&gt; '') then
    begin
      grdMain.Canvas.Brush.Color := clRed;
      grdMain.Canvas.Font.Color := clWhite;
      grdMain.DefaultDrawColumnCell(Rect, DataCol, Column, State);
    end;
  end; 
  </code></pre>
  
  <p>I also have a button on my form which resets the DBGrid. This allows a user to show the full list of clients after a search has been completed (returning a small number of clients).</p>
  
  <p>My problem occurs when pressing the reset button. The button executes the following SQL function (within a procedure called <code>ResetMemberGrid</code>) correctly, as the full list is displayed.</p>
  
  <blockquote>
    <p>SELECT * FROM customers</p>
  </blockquote>
  
  <p>However, the DBGrid is not colored anymore. All the rows remain white. I have not been able to call the <code>grdMainDrawColumnCell</code> procedure, as it requires parameters which I am not aware of. Is there a way to call the DrawColumnCell procedure? I have tried to Repaint, Invalidate and Refresh the DBGrid, with no luck. Thanks.</p>