May 19, 2021 WeChat Mini Program Development Document
Drawing interfaces and methods
Draw a rectangle (non-filled).
Tip: Set
the
setFillStroke()
if you don't set the default to black.
Parameters | Type | Range | Description |
---|---|---|---|
Ⅹ | Number | The x coordinates in the upper left corner of the rectangular path | |
Y | Number | The y coordinates in the upper left corner of the rectangular path | |
width | Number | The width of the rectangular path | |
height | Number | The height of the rectangular path |
const ctx = wx.createCanvasContext('myCanvas')
ctx.setStrokeStyle('red')
ctx.strokeRect(10, 10, 150, 75)
ctx.draw()