Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program API drawing fillRect (filled rectangle)


May 19, 2021 WeChat Mini Program Development Document


Table of contents


WeChat small program API drawing fillRect (filled rectangle) Drawing interfaces and methods


canvasContext.fillRect


Defined

Fill a rectangle.

Tip : Set setFillStyle() if black by default is not set.

Parameters

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

Example

const ctx = wx.createCanvasContext('myCanvas')
ctx.setFillStyle('red')
ctx.fillRect(10, 10, 150, 75)
ctx.draw()

WeChat small program API drawing fillRect (filled rectangle)

WeChat small program API drawing fillRect (filled rectangle) Drawing interfaces and methods