How do I change the Color of a Control on TDBCtrlGrid for the selected Panel?

I have a TDBEdit control located on my TDBCtrlGrid.

I would like to change its font colour for the selected Panel in the Grid.

I have tried writing the below code, but can't seem to be able to access the
Controls actually on the Panel.

procedure TfmCPR.cgrdAdminACACLPaintPanel(DBCtrlGrid: TDBCtrlGrid; Index:
Integer);

{---------------------------------------------------------------------------
-}
  procedure SetUserNameColor(Selected: Boolean);
  var
    GridIndex: Integer;
    edUserName: TDBEdit;
  begin
    for GridIndex := 0 to DBCtrlGrid.ControlCount - 1 do
    begin
      if DBCtrlGrid.Controls[GridIndex] is TDBEdit then
      begin
        edUserName := TDBEdit(DBCtrlGrid.Controls[GridIndex]);
        if Selected then
          edUserName.Font.Color := clMaroon
        else
          edUserName.Font.Color := clWindowText;
        Exit;
      end;
    end;
  end;

{---------------------------------------------------------------------------
-}
begin
  inherited;

  if Index = DBCtrlGrid.PanelIndex then
    SetUserNameColor(True)
  else
    SetUserNameColor(False);

end;

Thank you for any assistance.

Regards,
Shaun Hogarth

Delphi 6 Ent SP2. XP Pro. MSSQLServer2000. LMD Tools 6
~~~~~~~~~~~~~~~~~~~~~~~~~
This message was sent by
Shaun Hogarth from
Perth, Western Australia
~~~~~~~~~~~~~~~~~~~~~~~~~