title: Using TFrame, how do I properly access the TCanvas property just as in a TForm?
body: <p>I need to draw on the frames Canvas at runtime just like you would do with a normal form but for some reason they decided not to add the Canvas property to the frame even tho both TCustomFrame and TCustomForm come from the same parent class that handles the Canvas.</p>
  
  <p>I've made it work up to the part where I can draw something by overriding the PaintWindow procedure but I still can't seem to use the Canvas property at runtime as if I'm missing a big chunk of the code.</p>
  
  <p>Here's what I've done up to now :</p>
  
  <pre><code>TCustomFrameEx = class(TCustomFrame)
    private
      FCanvas: TControlCanvas;
      function GetCanvas: TCanvas;
    public
    property Canvas: TCanvas read GetCanvas;
  end;
  
  TFrame = class(TCustomFrameEx)
    protected
      procedure PaintWindow(DC: HDC); override;        
    public
      constructor Create(AOwner: TComponent); override;
      destructor Destroy(); override;
    published
      ...
    end;
  
  constructor TFrame.Create(AOwner: TComponent);
  begin
    inherited;
    FCanvas := TControlCanvas.Create();
  end;
  
  destructor TFrame.Destroy();
  begin
    FreeAndNil(fCanvas);
    inherited;
  end;
  
  function TCustomFrameEx.GetCanvas : TCanvas;
  begin
    Result := fCanvas;
  end;
  
  procedure TFrame.PaintWindow(DC: HDC);
  begin
    inherited;
    FCanvas.Handle := DC;
    FCanvas.Control := Self;
    FCanvas.Brush.Color := clWhite;
    fCanvas.FillRect(GetClientRect);
    FCanvas.Handle := 0;
  end;
  </code></pre>
  
  <p>I assume I'm not properly assigning the handle or missing some paint event?</p>