unit UExtended;

interface
uses
  ComCtrls, Graphics, Messages, Classes, Windows, Vcl.StdCtrls, Vcl.Controls, Vcl.Grids ;

type

 //VHAIPSBELLC - added to revert page colors
 TTabSheet = class(ComCtrls.TTabSheet)
  private
    FColor: TColor;
    procedure WMEraseBkGnd(var Msg: TWMEraseBkGnd); message WM_ERASEBKGND;
  public
    constructor Create(aOwner: TComponent); override;
  end;

   TRadioButton = class(Vcl.StdCtrls.TRadioButton)
  private
    procedure WMEraseBkGnd(var Msg: TWMEraseBkGnd); message WM_ERASEBKGND;
    procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
  end;

     TStringGrid = class(Vcl.Grids.TStringGrid)
  private
    procedure WMEraseBkGnd(var Msg: TWMEraseBkGnd); message WM_ERASEBKGND;
    procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
  end;

implementation

//----------------- TTabSheet -----------------//
constructor TTabSheet.Create(aOwner: TComponent);
begin
  inherited;
  FColor := clBtnFace;
end;

procedure TTabSheet.WMEraseBkGnd(var Msg: TWMEraseBkGnd);
begin
    Brush.Color := FColor;
    Windows.FillRect(Msg.dc, ClientRect, Brush.Handle);
    Msg.Result := 1;
end;

//----------------- TRadioButton -----------------//
procedure TRadioButton.WMEraseBkGnd(var Msg: TWMEraseBkGnd);
begin
  if not ParentColor then
  begin
    Brush.Color := Color;//FColor;
    Windows.FillRect(Msg.dc, ClientRect, Brush.Handle);
    Msg.Result := 1;
  end else
   inherited;
end;

procedure TRadioButton.CMColorChanged(var Message: TMessage);
begin
  self.Repaint;
end;

//----------------- TStringGrid -----------------//
procedure TStringGrid.WMEraseBkGnd(var Msg: TWMEraseBkGnd);
begin
  if not ParentColor then
  begin
    Brush.Color := Color;//FColor;
    Windows.FillRect(Msg.dc, ClientRect, Brush.Handle);
    Msg.Result := 1;
  end else
   inherited;
end;

procedure TStringGrid.CMColorChanged(var Message: TMessage);
begin
  self.Repaint;
end;


end.
