[MSPAINT] Canvas: Don't draw new frame if HIT_NONE

CORE-18867
This commit is contained in:
Katayama Hirofumi MZ 2023-04-09 08:49:18 +09:00
parent 132f482de2
commit f45d80adc9
2 changed files with 6 additions and 4 deletions

View file

@ -155,7 +155,7 @@ VOID CCanvasWindow::DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint)
}
// Draw new frame if any
if (!::IsRectEmpty(&m_rcNew))
if (m_whereHit != HIT_NONE && !::IsRectEmpty(&m_rcNew))
DrawXorRect(hdcMem, &m_rcNew);
// Transfer the bits
@ -668,8 +668,9 @@ LRESULT CCanvasWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
if (wParam == VK_ESCAPE && ::GetCapture() == m_hWnd)
{
// Cancel dragging
m_whereHit = HIT_NONE;
::ReleaseCapture();
m_whereHit = HIT_NONE;
::SetRectEmpty(&m_rcNew);
Invalidate(TRUE);
}
@ -680,6 +681,7 @@ LRESULT CCanvasWindow::OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
{
// Cancel dragging
m_whereHit = HIT_NONE;
::SetRectEmpty(&m_rcNew);
Invalidate(TRUE);
return 0;
}

View file

@ -439,7 +439,7 @@ LRESULT CMainWindow::OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM lParam, BO
EnableMenuItem(menu, IDM_EDITINVERTSELECTION, ENABLED_IF(trueSelection));
EnableMenuItem(menu, IDM_EDITCOPYTO, ENABLED_IF(trueSelection));
OpenClipboard();
EnableMenuItem(menu, IDM_EDITPASTE, ENABLED_IF(GetClipboardData(CF_BITMAP) != NULL));
EnableMenuItem(menu, IDM_EDITPASTE, ENABLED_IF(IsClipboardFormatAvailable(CF_BITMAP)));
CloseClipboard();
break;
case 2: /* View menu */
@ -661,7 +661,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
break;
case IDM_EDITPASTE:
OpenClipboard();
if (GetClipboardData(CF_BITMAP) != NULL)
if (IsClipboardFormatAvailable(CF_BITMAP))
{
InsertSelectionFromHBITMAP((HBITMAP) GetClipboardData(CF_BITMAP), m_hWnd);
}