HTML5 canvas strokeRect() ·½·¨

ʵÀý

»æÖÆ 150*100 ÏñËØµÄ¾ØÐΣº

Your browser does not support the HTML5 canvas tag.

JavaScript:

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.strokeRect(20,20,150,100);

Ç××ÔÊÔÒ»ÊÔ

ä¯ÀÀÆ÷Ö§³Ö

Internet Explorer 9¡¢Firefox¡¢Opera¡¢Chrome ÒÔ¼° Safari Ö§³Ö strokeRect() ·½·¨¡£

×¢ÊÍ£ºInternet Explorer 8 »ò¸üÔçµÄä¯ÀÀÆ÷²»Ö§³Ö <canvas> ÔªËØ¡£

¶¨ÒåºÍÓ÷¨

strokeRect() ·½·¨»æÖƾØÐΣ¨²»ÌîÉ«£©¡£±Ê´¥µÄĬÈÏÑÕÉ«ÊǺÚÉ«¡£

Ìáʾ£ºÇëʹÓà strokeStyle ÊôÐÔÀ´ÉèÖñʴ¥µÄÑÕÉ«¡¢½¥±ä»òģʽ¡£

JavaScript Óï·¨£º

context.strokeRect(x,y,width,height);

²ÎÊýÖµ

²ÎÊý ÃèÊö
x ¾ØÐÎ×óÉÏ½ÇµÄ x ×ø±ê
y ¾ØÐÎ×óÉÏ½ÇµÄ y ×ø±ê
width ¾ØÐεĿí¶È£¬ÒÔÏñËØ¼Æ
height ¾ØÐεĸ߶ȣ¬ÒÔÏñËØ¼Æ
VUE