位图)并转QImage"/>
Qt之使用bitblt抓取bitmap(位图)并转QImage
一.效果
点击按钮抓取窗口自身并显示到QLable中
二.实现
pro文件
QT += core guigreaterThan(QT_MAJOR_VERSION, 4): QT += widgetsCONFIG += c++11SOURCES += \
main.cpp \
mainwindow.cppHEADERS += \
mainwindow.hFORMS += \
mainwindow.uiLIBS += -lgdi32 -luser32 -lDwmapi
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"#include <Windows.h>
#include <windowsx.h>
#include <Dwmapi.h>
#include <QPixmap>
#include <QImage>
#include <QDebug>MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}MainWindow::~MainWindow()
{
更多推荐
Qt之使用bitblt抓取bitmap(位图)并转QImage
发布评论