qt creator #include #include "widget.h" #include "ui_widget.h" Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); bmp=new QPixmap("../painter/image/Winter.jpg"); } void Widget::paintEvent(QPaintEvent *) { QPixmap temp = bmp->copy();//复制Bmp图像 QPainter painter(&temp;); QPen pen; //画笔 pen.setColor(QColor(255,0,0));