HTML tuvali StrokRect() Yöntemi

❮ HTML Kanvas Referansı

Örnek

150*100 piksellik bir dikdörtgen çizin:

TarayıcınızHTML5tuval etiketini desteklemiyor.

JavaScript:

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

Tarayıcı Desteği

Tablodaki sayılar, yöntemi tam olarak destekleyen ilk tarayıcı sürümünü belirtir.

Method
strokeRect() Yes 9.0 Yes Yes Yes

Tanım ve Kullanım

StrokRect() yöntemi bir dikdörtgen çizer (dolgusuz). Konturun varsayılan rengi siyahtır.

İpucu: Konturun stilini belirlemek üzere bir renk, degrade veya desen ayarlamak için konturStyle özelliğini kullanın .

JavaScript sözdizimi: bağlam .strokeRect( x,y,genişlik,yükseklik );

Parametre Değerleri

Parameter Description Play it
x The x-coordinate of the upper-left corner of the rectangle
y The y-coordinate of the upper-left corner of the rectangle
width The width of the rectangle, in pixels
height The height of the rectangle, in pixels

❮ HTML Kanvas Referansı