代码拉取完成,页面将自动刷新
import QtQuick 2.0
Rectangle {
id: root;
Canvas {
contextType: "2d"
visible: true
anchors.fill: parent;
onPaint: {//绘图事件的响应
context.lineWidth=2;
context.strokeStyle="red";
context.fillStyle="blue";
context.beginPath();
context.rect(1,0,12,12);//一定要注意画图的区域不能超过画布的大小,不然会看不到或者只看到一部分
context.fill();
context.stroke();
}
// onPaint: {
// var ctx = getContext("2d");
// ctx.lineWidth = 2;
// ctx.strokeStyle = "red";
// ctx.fillStyle = "blue";
// ctx.beginPath();
// ctx.rect(10, 8, 12, 8);
// ctx.fill();
// ctx.stroke();
// }
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。