我在WM_MOUSEMOVE事件中添加如下处理实现 当鼠标在对话框内移动时设置窗口不透明,一旦鼠标移出窗口窗口变为透明的
void CXXXDlg::OnMouseMove(UINT nFlags, CPoint point)
{
CRect rect;
GetClientRect(rect);
//GetWindowRect(rect);
//ClientToScreen(rect);
//ClientToScreen(&point);
//GetCursorPos(&point);
if (rect.PtInRect(point))
{
SetLayeredWindowAttributes(0, 255, LWA_ALPHA);
SetCapture();
}
else
{
SetLayeredWindowAttributes( 0, 168, LWA_ALPHA);
ReleaseCapture();
} CDialog::OnMouseMove(nFlags, point);
}
由于SetCapture();捕获鼠标后窗口内鼠标单击窗口内的按钮或控件没有了响应请高手给出一个解决的办法
void CXXXDlg::OnMouseMove(UINT nFlags, CPoint point)
{
CRect rect;
GetClientRect(rect);
//GetWindowRect(rect);
//ClientToScreen(rect);
//ClientToScreen(&point);
//GetCursorPos(&point);
if (rect.PtInRect(point))
{
SetLayeredWindowAttributes(0, 255, LWA_ALPHA);
SetCapture();
}
else
{
SetLayeredWindowAttributes( 0, 168, LWA_ALPHA);
ReleaseCapture();
} CDialog::OnMouseMove(nFlags, point);
}
由于SetCapture();捕获鼠标后窗口内鼠标单击窗口内的按钮或控件没有了响应请高手给出一个解决的办法
SetTimer(1, 100, NULL);void CXXXDlg::OnTimer(UINT nIDEvent)
{
CPoint point;
GetCursorPos(&point);
CRect rect;
GetClientRect(rect);
//GetWindowRect(rect);
ClientToScreen(rect);
//ClientToScreen(&point);
//GetCursorPos(&point);
if (rect.PtInRect(point))
{
SetLayeredWindowAttributes(0, 255, LWA_ALPHA);
//SetCapture();
}
else
{ SetLayeredWindowAttributes( 0, 168, LWA_ALPHA);
//ReleaseCapture();
} CBCGPDialog::OnTimer(nIDEvent);
}