0
点赞
收藏
分享

微信扫一扫

Canvas--绘制矩形


import QtQuick 2.15
import QtQuick.Window 2.15

Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")

Canvas{
id:mycanvas
width: 200
height: 200
onPaint: {
var ctx = getContext("2d");
//ctx.fillStyle = "green"//填充
ctx.strokeStyle = "blue"//边线
ctx.lineWidth = 4 //边线宽度
ctx.lineJoin = "round" //边线连接样式(圆弧将拐角连接起来)
ctx.fillRect(20,20,160,160) //填充矩形
ctx.clearRect(30,30,140,140)//清空矩形
ctx.strokeRect(20,20,80,80) //以描边方式绘制矩形
}
}
}

Canvas--绘制矩形_css3


举报

相关推荐

0 条评论