I have a FireMonkey form with the following code in the OnPaint event of the form. I expected a ball with a radial gradient, but I get only a red ball, without a gradient. The question is what am I doing wrong. Launch on XE3. If I change the gradient style to gsLinear, I get a linear gradient. Is there anything else I should indicate to show a radial gradient?
procedure TForm2.FormPaint(Sender: TObject; Canvas: TCanvas; const ARect: TRectF);
var MyRect : TRectF;
begin
MyRect.Create (85, 85, 115, 115);
Canvas.Fill.Gradient.Style := TGradientStyle.gsRadial;
Canvas.Fill.Gradient.Color := claRed;
Canvas.Fill.Gradient.Color1 := claBlue;
Canvas.Fill.Kind := TBrushKind.bkGradient;
Canvas.FillEllipse (MyRect, 100);
end;
source
share