/*! * 设置Aero绘图区 */ bool QtWin::extendFrameIntoClientArea(QWidget *widget, int left, int top, int right, int bottom) { Q_ASSERT(widget); Q_UNUSED(left); Q_UNUSED(top); Q_UNUSED(right); Q_UNUSED(bottom); bool result = false; #ifdef Q_WS_WIN if (resolveLibs()) { QLibrary dwmLib(QString::fromAscii("dwmapi")); HRESULT hr = S_OK; MARGINS m = {left, top, right, bottom}; hr = pDwmExtendFrameIntoClientArea(widget->winId(), &m); if (SUCCEEDED(hr)) { result = true; windowNotifier()->addWidget(widget); } widget->setAttribute(Qt::WA_TranslucentBackground, result); } #endif return result; }
bool QtWin::enableBlurBehindWindow(QWidget *widget, bool enable) { bool result = false; #ifdef Q_WS_WIN if(resolveLibs()) { DWM_BLURBEHIND bb = {0}; HRESULT hr = S_OK; bb.fEnable = enable; bb.dwFlags = DWM_BB_ENABLE; bb.hRgnBlur = NULL; widget->setAttribute(Qt::WA_TranslucentBackground, enable); widget->setAttribute(Qt::WA_NoSystemBackground, enable); hr = pDwmEnableBlurBehindWindow(widget->winId(), &bb); if(SUCCEEDED(hr)) { result = true; windowNotifier()->addWidget(widget); } } #endif return result; }