rect method
[This documentation is preliminary and is subject to change.]
Creates a new closed rectangular subpath.
![]() ![]() |
Syntax
HRESULT retVal = object.rect(x, y, w, h);
Standards information
- HTML Canvas 2D Context, Section 9
Parameters
x [in]
Type: floatThe x-coordinate, in pixels, of the upper-left corner of the rectangle in relation to the coordinates of the canvas.
y [in]
Type: floatThe y-coordinate, in pixels, of the upper-left corner of the rectangle in relation to the coordinates of the canvas.
w [in]
Type: floatThe width, in pixels, of the rectangle in relation to the coordinates of the canvas.
h [in]
Type: floatThe 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.
Remarks
The rect method creates a closed path for the rectangle and then starts a new subpath at the point (x, y). You can fill the rectangle by using the fillStyle property and the fill method.
Build date: 1/23/2012
.png)
.png)