4

I have a very simple FireMonkey application with a single form and the following code in the OnPaint event. When I run it using the Windows target, I see a red line and a red square. When I run it on my Android Nexus 7, only the square appears. I must be doing something silly, but what might it be?

Thanks for any help.

procedure TForm2.FormPaint(Sender: TObject; Canvas: TCanvas;
  const ARect: TRectF);
begin
    Canvas.Stroke.Color := claRed;
    Canvas.Fill.Color := claRed;

    Canvas.Stroke.Thickness := 3;

    Canvas.DrawLine( PointF( 0, 0 ), PointF( 200, 200 ), 1.0 );

    Canvas.FillRect( RectF( 300, 300, 500, 500 ), 0.0, 0.0, [], 1.0  );
end;
Brian Frost
  • 13,334
  • 11
  • 80
  • 154
  • Just out of interest, have you also tried the `StrokeThickness` property, as documented at http://docwiki.embarcadero.com/Libraries/XE5/en/FMX.Graphics.TCanvas.StrokeThickness as opposed to the `Stroke.Thickness` currently in use? – blong Nov 06 '13 at 14:16
  • I don't have access to the source here, so they may in fact be one and the same as one would expect, but one never knows, so it's worth double-checking. Or at least checking... If they behave differently, please be sure to file a QC report. – blong Nov 06 '13 at 14:25
  • @blong: I've tried various values of "Canvas.StrokeThickness" with and inplace of "Canvas.Stroke.Thickness". The output is always only a red square. – Brian Frost Nov 06 '13 at 14:27
  • Does this bug report have any bearing on the matter? http://qc.embarcadero.com/wc/qcmain.aspx?d=119515 – blong Nov 06 '13 at 14:51

1 Answers1

9

I found that Canvas.Stroke.Kind under Android is initialised to bkNone (the 0'th ordinal) so no output.

You need to include Canvas.Stroke.Kind := TBrushKind.bkSolid before you get output.

NGLN
  • 43,011
  • 8
  • 105
  • 200
Brian Frost
  • 13,334
  • 11
  • 80
  • 154