Rect rect m_stPicture->GetWindowRect(&rect);PtInRect(mousePt, rect);
PtInRect The PtInRect function determines whether the specified point lies within the specified rectangle. A point is within a rectangle if it lies on the left or top side or is within all four sides. A point on the right or bottom side is considered outside the rectangle. BOOL PtInRect( CONST RECT *lprc, // rectangle POINT pt // point ); Parameters lprc [in] Pointer to a RECT structure that contains the specified rectangle. pt [in] Specifies a POINT structure that contains the specified point.
m_stPicture->GetWindowRect(&rect);PtInRect(mousePt, rect);
The PtInRect function determines whether the specified point lies within the specified rectangle. A point is within a rectangle if it lies on the left or top side or is within all four sides. A point on the right or bottom side is considered outside the rectangle. BOOL PtInRect(
CONST RECT *lprc, // rectangle
POINT pt // point
);
Parameters
lprc
[in] Pointer to a RECT structure that contains the specified rectangle.
pt
[in] Specifies a POINT structure that contains the specified point.
CRect rect;
m_stPicture.GetWindowRect(&rect);
ScreenToClient(&rect);
if (point.x >rect.left && point.x <rect.right &&point.y > rect.top && point.y <rect.bottom)
{
MessageBox("框内");
}