Compartilhar via


height property

Gets or sets the height of a canvas element on a document.

This property is read/write.

 

Syntax

HRESULT put_height(
  [in]          long v
);

HRESULT get_height(
  [out, retval] long *height
);

Property values

Type: long

The height of a canvas element, in pixels.

Standards information

Remarks

Note  The maximum size of the rendered area on a canvas is from 0,0 to 8192 x 8192 pixels, regardless of the size of the canvas. For example, a canvas is created with a width and height of 8292 pixels. A rectangular fill is then applied as "ctx.fillRect (0,0, canvas.width, canvas.height)".Only the area within the coordinates (0, 0, 8192, 8192) can be rendered, leaving a 100 pixel border on the right and bottom of the canvas.

 

Note  When sizing a canvas, use the canvas IHTMLCanvasElement::width and IHTMLCanvasElement::height properties to get your initial size. You can use CSS to set the width and height, but it will scale the image rather than set the canvas size itself. The default width and height are 300px by 150px.