title: Drawing to FireMonkey TControl.Canvas outputs to TForm Canvas
body: <p>I've just started transitioning a huge codebase to FireMonkey but I'm having some difficulties.</p>
  
  <p>One thing tripping me up is a major gotcha with TControl.Canvas. If I don't call it correctly, then drawing to the TCanvas, actually draws to the form canvas (to be specific, it draws at 0,0 on the form, rather than the client origin of my custom control).</p>
  
  <p>For example, in a MouseMove event I need to draw a selection. Here is some example code:</p>
  
  <pre><code>procedure TMyCustomControl.MouseMove(Shift: TShiftState; sX, sY: Single);
  begin
    inherited;
  
    ...
    Paint();
  end;
  
  procedure TMyCustomControl.Paint();
  begin
    PaintToCanvas(Canvas);
  end; 
  </code></pre>
  
  <p>Using this code in FireMonkey, painting is to the form (i.e. outputs at 0,0 on the form).</p>
  
  <p>If I change the code in MouseMove to Repaint(); then it paints correctly to my control.</p>
  
  <p>Clearly, with FMX, I need to trigger the control's actual painting (not just paint directly), otherwise the Canvas is not valid.</p>
  
  <p>What I need is an explanation as to why it functions like this. I have a lot of canvas drawing in my code, so I need to understand this so I can hunt out other incompatible code.</p>
  
  <p>System: Delphi 10.3 Rio, 32 or 64bit Windows apps.</p>