Loading

Duilib + wke 设置wke背景透明

WkeWebKit.cpp 新增 wkeSetTransparent(m_pWebView, true);

void CWkeWebkitUI::DoInit()
{
	CControlUI::DoInit();
	// 设置UA
	wkeSetUserAgent(m_pWebView, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2228.0 Safari/537.36");
	// 设置名称
	wkeSetName(m_pWebView, T2ANSI(GetName()).c_str());
	// 设置窗口透明
	wkeSetTransparent(m_pWebView, true);
	// 启动定时器
	SetTimer(EVENT_TICK_TIEMER_ID, 30);
	// 初始化后回调接口
	wkeOnTitleChanged(m_pWebView, OnWkeTitleChanged, this);
	wkeOnURLChanged(m_pWebView, OnWkeURLChanged, this);
	wkeOnNavigation(m_pWebView, OnWkeNavigation, this);
	wkeOnCreateView(m_pWebView, OnWkeCreateView, this);
	wkeOnDocumentReady(m_pWebView, OnWkeDocumentReady, this);
	wkeOnLoadingFinish(m_pWebView, OnWkeLoadingFinish, this);
}

// 以及 void CWkeWebkitUI::DoPaint(HDC hDC, const RECT& rcPaint) 中
// ::BitBlt(hDC, m_RendData.rt.left, m_RendData.rt.top, m_RendData.rt.right - m_RendData.rt.left, m_RendData.rt.bottom - m_RendData.rt.top, m_RendData.hDC, 0, 0, SRCCOPY);
// 修改为
BLENDFUNCTION bf = { AC_SRC_OVER, 0, 0xFF, AC_SRC_ALPHA };
::AlphaBlend(hDC, m_RendData.rt.left, m_RendData.rt.top, m_RendData.rt.right - m_RendData.rt.left, m_RendData.rt.bottom - m_RendData.rt.top, m_RendData.hDC, 0, 0, m_RendData.rt.right - m_RendData.rt.left, m_RendData.rt.bottom - m_RendData.rt.top, bf);
否则会出现wke窗口透过程序窗口直接看到桌面

posted @ 2018-06-08 11:18  纯白、色  阅读(496)  评论(0编辑  收藏  举报