对于xtow,我想绘制一个顶级窗口,其中包含标准的非客户区域,客户区域填充了一个具有alpha通道的位图.
我现在发现我在Windows 7上实现此方法的方法,但在Windows 8.1上无法正确呈现,在移动或最大化时留下窗口内容的图像.
为了调查,我做了一个简单的测试程序alpha测试,其中
//
// g++ alpha-test.cc -o alpha-test -mwindows -lgdiplus -ldwmapi
//
#define _WIN32_WINNT 0x0600
#include <assert.h>
#include <stdio.h>
#include <windows.h>
#include <gdiplus.h>
#include <dwmapi.h>
int width = 360;
int height = 360;
HBITMAP hBitmap;
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdcUpdate = BeginPaint(hWnd, &ps);
RECT rc;
GetClientRect(hWnd, &rc);
HBRUSH hbrush = CreateSolidBrush(RGB(0,0,0));
FillRect(hdcUpdate, &rc, hbrush);
DeleteObject(hbrush); …Run Code Online (Sandbox Code Playgroud)