表格控件點擊彈出月曆控件,兩者重疊。月曆雖在最上層(Z-Order),點擊時表格「漏出」,月曆顯示不全、事件錯亂。
cal.Create(WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_BORDER, rect, this, IDC_CALENDAR);
cal.SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
void CMyGrid::OnLButtonDown(UINT nFlags, CPoint point) {
if (hitTestCell(point)) {
GetParent()->GetDlgItem(IDC_GRID)->EnableWindow(FALSE); // 禁用表格
GetParent()->GetDlgItem(IDC_CALENDAR)->ShowWindow(SW_SHOW);
GetParent()->GetDlgItem(IDC_CALENDAR)->SetFocus();
}
CWnd::OnLButtonDown(nFlags, point);
}
GetParent()->GetDlgItem(IDC_GRID)->EnableWindow(TRUE);
GetParent()->GetDlgItem(IDC_CALENDAR)->ShowWindow(SW_HIDE);