I want to draw a dotted grid on a TPaintbox canvas in a Firemonkey project, the outcome should be exactly like this:
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:
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);
The result is not what I had hoped, in fact the TLine
shape can do a dotted line how I want it to:
But I need to do this drawing myself on the canvas and not use additional controls. For the record TLine
simply needs the Stroke.Dash property changing to Dot.
So, using the canvas in a Firemonkey project how may I draw a dotted line the same as TLine
does so that I can draw a grid like the first sample image?