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

WeChat small program API drawingstrokeRect (draw a rectangle, non-filled)


May 19, 2021 WeChat Mini Program Development Document


Table of contents


WeChat small program API drawingstrokeRect (draw a rectangle, non-filled) Drawing interfaces and methods

canvasContext.strokeRect


Defined

Draw a rectangle (non-filled).

Tip: Set the setFillStroke() if you don't set the default to black.

Parameters

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

Example

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

WeChat small program API drawingstrokeRect (draw a rectangle, non-filled)

WeChat small program API drawingstrokeRect (draw a rectangle, non-filled) Drawing interfaces and methods