亚洲区国产区激情区无码区,国产成人mv视频在线观看,国产A毛片AAAAAA,亚洲精品国产首次亮相在线

HTML 參考手冊(cè)

HTML 標(biāo)簽大全

HTML canvas strokeRect() 方法

strokeRect() 是 Canvas 2D API 在 canvas 中,使用當(dāng)前的繪畫(huà)樣式,描繪一個(gè)起點(diǎn)在 (x, y) 、寬度為 w 、高度為 h 的矩形的方法。 此方法直接繪制到畫(huà)布而不修改當(dāng)前路徑,因此任何后續(xù)fill() 或stroke()調(diào)用對(duì)它沒(méi)有影響。

HTML canvas 參考手冊(cè)

在線示例

繪制 100*100 像素的正方形:

您的瀏覽器,不支持HTML5 canvas標(biāo)簽.
<!DOCTYPE html>
<html>
<head>
<title>HTML canvas strokeRect() 方法的使用(菜鳥(niǎo)教程 cainiaoplus.com)</title>
</head>
<body>
<canvas id="myCanvas" width="300" height="150" style="border:1px solid #d3d3d3;">
您的瀏覽器不支持 HTML5 canvas 標(biāo)簽。
</canvas>
<script>
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.strokeRect(20,20,100,100);
</script>
</body>
</html>
測(cè)試看看 ?/?

瀏覽器兼容性

IEFirefoxOperaChromeSafari

Internet Explorer 9、Firefox、Opera、Chrome 和 Safari 支持 strokeRect() 方法。

注意:Internet Explorer 8 及之前的版本不支持 <canvas> 元素。

定義和用法

strokeRect() 方法繪制一個(gè)矩形(不填充)。筆劃的默認(rèn)顏色是黑色。

提示:請(qǐng)使用 strokeStyle 屬性來(lái)設(shè)置筆觸的顏色、漸變或模式。

JavaScript 語(yǔ)法:context.strokeRect(x,y,width,height);

參數(shù)值

參數(shù)描述
x矩形左上角的 x 坐標(biāo)。
y矩形左上角的 y 坐標(biāo)。
width矩形的寬度,以像素計(jì)。
height矩形的高度,以像素計(jì)。
HTML canvas 參考手冊(cè)