StrokeStyle Property
Class THtml5Canvas2D
The StrokeStyle property sets or returns the color, gradient, or pattern used for strokes.
Property Values
A color value that indicates the stroke color of the drawing. Defaul value: #000000 .
A gradient object used to create a gradient stroke.
A pattern object used to create a pattern stroke.
Examples:
Draw a rectangle. Use a stroke color of red:
Canvas.StrokeStyle := #FF0000;
Canvas.StrokeRect(10,10,160,110);
Draw a rectangle. Use a gradient stroke:
var
Gradient: TCanvasLinearGradient;
Gradient :=
Canvas.CreateLinearGradient(0,0,150,0);
Gradient.AddColorStop(0,clMagenta);
Gradient.AddColorStop(0.5,clBlue);
Gradient.AddColorStop(1,clRed);
Canvas.StrokeStyle := Gradient;
Canvas.LineWidth := 5;
Canvas.StrokeRect(20,15,150,100);
Write the text "HTML Canvas", with a gradient stroke:
var
Gradient: TCanvasLinearGradient;
Font: TCanvasFont;
Gradient :=
Canvas.CreateLinearGradient(0,0,170,0);
Gradient.AddColorStop(0,clMagenta);
Gradient.AddColorStop(0.5,clBlue);
Gradient.AddColorStop(1,clRed);
Canvas.StrokeStyle := Gradient;
Font := Canvas.CreateFont;
Font.Size := 30;
Font.Family := 'Verdana';
Canvas.Font := Font;
Canvas.StrokeText('HTML Canvas',10,50);