[MSPAINT] Use CF_DIB instead of CF_BITMAP (#5349)

CF_BITMAP is not recommended format for copying. In fact, Win10 won't accept it.
- Use CF_DIB clipboard format instead of CF_BITMAP in copying.
- Use CF_ENHMETAFILE, CF_DIB, or CF_BITMAP in pasting.
- Add BitmapToClipboardDIB, BitmapFromClipboardDIB, and BitmapFromHEMF helper functions to dib.cpp.
- Re-enable paste by fixing the bug that is embugged in the previous commit.
- Enable Cut, Copy, Paste, and Delete on text editing box by modifying OnInitMenuPopup.
- Add IDS_CANTPASTE resource string to show message on paste failure.
CORE-18867
This commit is contained in:
Katayama Hirofumi MZ 2023-06-18 19:48:20 +09:00 committed by GitHub
parent aaa0cb6724
commit 9f56e67bc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 320 additions and 45 deletions

View file

@ -205,8 +205,12 @@ void SelectionModel::InsertFromHBITMAP(HBITMAP hBm, INT x, INT y)
m_rc.left = x;
m_rc.top = y;
m_rc.right = m_rc.left + GetDIBWidth(hBm);
m_rc.bottom = m_rc.top + GetDIBHeight(hBm);
m_rc.right = x + GetDIBWidth(hBm);
m_rc.bottom = y + GetDIBHeight(hBm);
// If m_rc and m_rcOld were same, the image cannot be pasted to the canvas.
// See also SelectionModel::Landing
::SetRect(&m_rcOld, -2, -2, -1, -1); // Outside of image
ClearMask();
}