先来看看效果,是这样的。
人物是动态的。相当生动。
软件是基于QT开发的 MFC 同理 。 代码量相当少,创建一个透明窗口,设置一个时钟,让素材中的 不同的图片 依次出现在窗口上即可。
代码如下:
#include "setwidget.h"
#include "ui_setwidget.h"
SetWidget::SetWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::SetWidget)
{
ui->setupUi(this);
this->srcPath=":/image/back/play.gif";
this->desktop=FindWindowEx(NULL,NULL,L"Progman",NULL);
this->srclabel=new QLabel;
this->bgWidget=new QWidget;
setBgImage();
}
SetWidget::~SetWidget()
{
delete ui;
}
void SetWidget::setBgImage()
{
this->srclabel->setParent(bgWidget);
this->srclabel->setGeometry(0,0,1920,1080);
this->srclabel->setScaledContents(true);//缩放
if(this->srcPath!="")
{
srclabel->setPixmap(QPixmap(srcPath));
}
if(desktop)
{
SetParent((HWND)bgWidget->winId(),this->desktop);
}
bgWidget->setWindowFlags(Qt::FramelessWindowHint);
bgWidget->showFullScreen();
}
#include "setwidget.h"
#include "ui_setwidget.h"
SetWidget::SetWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::SetWidget)
{
ui->setupUi(this);
this->srcPath=":/image/back/play.gif";
this->desktop=FindWindowEx(NULL,NULL,L"Progman",NULL);
this->srclabel=new QLabel;
this->bgWidget=new QWidget;
setBgImage();
}
SetWidget::~SetWidget()
{
delete ui;
}
void SetWidget::setBgImage()
{
this->srclabel->setParent(bgWidget);
this->srclabel->setGeometry(0,0,1920,1080);
this->srclabel->setScaledContents(true);//缩放
if(this->srcPath!="")
{
srclabel->setPixmap(QPixmap(srcPath));
}
if(desktop)
{
SetParent((HWND)bgWidget->winId(),this->desktop);
}
bgWidget->setWindowFlags(Qt::FramelessWindowHint);
bgWidget->showFullScreen();
}
有兴趣的可以研究下,很快自己也能写出一样的效果。(*╹▽╹*)