1
我有一個分層窗口(WS_EX_LAYERED),實現了自定義NCHITTEST和NCCALCSIZE,使窗口的客戶端矩形與窗口矩形一樣。我的窗戶尺寸和顏色正確;當光標靠近窗口的底部邊緣時,我可以從WM_NCHITTEST返回HTBOTTOM,以產生垂直調整大小的窗口從底部類型的動作。但是,我沒有得到垂直調整大小的光標。有沒有辦法解決這個問題,而不必實現WM_SETCURSOR並測試指針的位置與窗口的邊緣?WM_NCHITTEST不改變鼠標光標
這裏是我的代碼片段:
case WM_NCCALCSIZE:
// Bypass DefWindowProc, so the Window Rect == Client Rect
return 0;
case WM_NCHITTEST: {
RECT w;
::GetWindowRect(hwnd, &w);
// Compare the mouse X/Y vs the rect of the window to detect
// resizing from the bottom edges
int r = HTCLIENT;
int x = GET_X_LPARAM(lParam);
int y = GET_Y_LPARAM(lParam);
if (w.bottom - y < 10) {
// If I was not using NCHITTEST, I should get a verticle resize pointer here
if (x - w.left < 10)
r = HTBOTTOMLEFT;
else if (w.right - x < 10)
r = HTBOTTOMRIGHT;
else
r = HTBOTTOM;
}
return r;
}
沒有攝製。也沒有看到任何錯誤。我不得不猜測透明鍵是問題所在。 –