[MSPAINT] Check out of image in updating status bar (#5779)

Check out of the image by using ::PtInRect and CCanvasWindow::GetImageRect.
If out, then don't show the status bar text.
CORE-19219
This commit is contained in:
Katayama Hirofumi MZ 2023-10-09 08:39:31 +09:00 committed by GitHub
parent 611d89eb8b
commit 0c164f081a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -400,8 +400,12 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
if (!m_drawing)
{
RECT rcImage;
GetImageRect(rcImage);
CString strCoord;
strCoord.Format(_T("%ld, %ld"), pt.x, pt.y);
if (::PtInRect(&rcImage, pt))
strCoord.Format(_T("%ld, %ld"), pt.x, pt.y);
::SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM) (LPCTSTR) strCoord);
}
}