- Duilib界面需要通过全窗口来拖动窗口位置时,可以在OnNcHitTest函数中通过以下代码实现,也不影响其他控件的使用:
POINT pt; pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam); ::ScreenToClient(*this, &pt); RECT rcClient; ::GetClientRect(*this, &rcClient); RECT rcCaption = m_pm.GetCaptionRect(); if (pt.x >= rcClient.left && pt.x < rcClient.right && pt.y >= rcClient.top && pt.y < rcClient.bottom) { CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(pt)); if (pControl && _tcscmp(pControl->GetClass(), DUI_CTR_BUTTON) != 0 && _tcscmp(pControl->GetClass(), DUI_CTR_OPTION) != 0 && _tcscmp(pControl->GetClass(), DUI_CTR_TEXT) != 0) return HTCAPTION; } return HTCLIENT;
时间: 2024-10-31 07:55:40