编辑:我使用以下代码在窗口的非客户区(标题栏)上绘制了一个按钮。所以我的问题是:是否可以从此按钮处理鼠标单击事件?
bool MainWindow::winEvent(MSG *pMessage, long *result)
{
UINT m = pMessage->message;
if(m == WM_NCPAINT || m == WM_ACTIVATE)
{
HWND id = winId();
HDC hDeviceContext = GetWindowDC(id);
RECT rc = {10, 10, 65, 25};
DrawFrameControl(hDeviceContext, &rc, DFC_BUTTON, DFCS_BUTTONPUSH);
ReleaseDC(id, hDeviceContext);
return true;
}
return QWidget::winEvent(pMessage, result);
}