May 19, 2021 WeChat Mini Program Development Document
Drawing interfaces and methods
Fill a rectangle.
Tip
: Set
setFillStyle()
if black by default is not set.
Parameters | Type | 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.setFillStyle('red')
ctx.fillRect(10, 10, 150, 75)
ctx.draw()