Export (0) Print
Expand All

strokeRect method

Creates an outline of the specified rectangle on a canvas by using the current stroke, line width, and join styles.

HTML Canvas 2D Context, Section 8Internet Explorer 9

Syntax


object.strokeRect(x, y, w, h);

Parameters

x [in]

Type: number

The x-coordinate, in pixels, of the upper-left corner of the rectangle in relation to the coordinates of the canvas.

y [in]

Type: number

The y-coordinate, in pixels, of the upper-left corner of the rectangle in relation to the coordinates of the canvas.

w [in]

Type: number

The width, in pixels, of the rectangle in relation to the coordinates of the canvas.

h [in]

Type: number

The height, in pixels, of the rectangle in relation to the coordinates of the canvas.

Return value

This method does not return a value.

Standards information

Remarks

The ICanvasRenderingContext2D::strokeRect method creates a path that requires the use of the ICanvasRenderingContext2D::stroke method to render the rectangle. The outline uses the current ICanvasRenderingContext2D::strokeStyle, ICanvasRenderingContext2D::lineWidth, ICanvasRenderingContext2D::lineJoin, and, when appropriate, ICanvasRenderingContext2D::miterLimit properties. If the w or h parameter is zero, a line is drawn. If the w and h parameters are zero, the rectangle is not drawn.

 

 

Community Additions

ADD
Show:
© 2014 Microsoft