duilib can be pulled to change the window size

xml 

<Window size="300,600" caption="0,0,180,30" roundcorner="5,5" sizebox="10,10,10,10" mininfo="280,70" maxinfo="300,700" >

 

Response message:

 

LRESULT CSubtitleWindow::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    POINT pt; pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam);
    ::ScreenToClient(*this, &pt);

    RECT rcClient;
    ::GetClientRect(*this, &rcClient);


    if (!::IsZoomed(*this))
    {         RECT rcSizeBox = m_PaintManager.GetSizeBox(); // GetSizeBox is used to get the sizebox attribute of the Window tag in xml, this attribute indicates how many pixels your mouse moves to the window border will change Success indicator (this indicator means that the window size can be changed)         if (pt.y <rcClient.top + rcSizeBox.top) {             if (pt.x <rcClient.left + rcSizeBox.left) return HTTOPLEFT;             if ( pt.x> rcClient.right-rcSizeBox.right) return HTTOPRIGHT;             return HTTOP;




        }
        else if (pt.y > rcClient.bottom - rcSizeBox.bottom) {
            if (pt.x < rcClient.left + rcSizeBox.left) return HTBOTTOMLEFT;
            if (pt.x > rcClient.right - rcSizeBox.right) return HTBOTTOMRIGHT;
            return HTBOTTOM;

        }
        if (pt.x < rcClient.left + rcSizeBox.left) return HTLEFT;
        if (pt.x > rcClient.right - rcSizeBox.right) return HTRIGHT;
    }

    RECT rcCaption = m_PaintManager.GetCaptionRect();
    if (pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.left + rcCaption.right\
        && pt.y >= rcCaption.top && pt.y < rcCaption.bottom) {
        return HTCAPTION;
    }

    return HTCLIENT;
}

 

Guess you like

Origin blog.csdn.net/kaizi318/article/details/82350999