title: How to draw a dotted line in Firemonkey?
body: <p>I want to draw a dotted grid on a TPaintbox canvas in a Firemonkey project, the outcome should be exactly like this:</p>
  
  <p><a href="https://i.stack.imgur.com/Mxf67.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mxf67.png" alt="enter image description here"></a></p>
  
  <p>To start with I thought I would draw the vertical dotted lines and then the horizontal dotted lines, so with that in mind I attempted to draw a single line first in attempt to get the appearance just right, this is what I tried:</p>
  
  <pre><code>Canvas.Stroke.Color := TAlphaColorRec.Black;
  Canvas.Stroke.Dash := TStrokeDash.Dot;
  Canvas.Stroke.Kind := TBrushKind.Solid;
  Canvas.Stroke.Thickness := 1;
  Canvas.DrawLine(PointF(0, 0), PointF(0, 150), 1);
  </code></pre>
  
  <p>The result is not what I had hoped, in fact the <code>TLine</code> shape can do a dotted line how I want it to:</p>
  
  <p><a href="https://i.stack.imgur.com/pww7A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pww7A.png" alt="enter image description here"></a></p>
  
  <p>But I need to do this drawing myself on the canvas and not use additional controls. For the record <code>TLine</code> simply needs the Stroke.Dash property changing to Dot.</p>
  
  <p>So, using the canvas in a Firemonkey project how may I draw a dotted line the same as <code>TLine</code> does so that I can draw a grid like the first sample image?</p>