strokeRect method
Creates an outline of the specified rectangle on a canvas by using the current stroke, line width, and join styles.
![]() ![]() |
Syntax
HRESULT retVal = object.strokeRect(x, y, w, h);
Parameters
- x [in]
-
Type: float
The x-coordinate, in pixels, of the upper-left corner of the rectangle in relation to the coordinates of the canvas.
- y [in]
-
Type: float
The y-coordinate, in pixels, of the upper-left corner of the rectangle in relation to the coordinates of the canvas.
- w [in]
-
Type: float
The width, in pixels, of the rectangle in relation to the coordinates of the canvas.
- h [in]
-
Type: float
The height, in pixels, of the rectangle in relation to the coordinates of the canvas.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Standards information
- HTML Canvas 2D Context, Section 8
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.
Build date: 11/12/2012

