mirror of
https://github.com/quantum5/MusicKeyboard.git
synced 2025-04-24 13:11:58 -04:00
Fixed DC eating
This commit is contained in:
parent
2ca1d5a9d3
commit
019567b10d
|
@ -473,7 +473,8 @@ void PianoControl::OnPaint()
|
||||||
hMemDC = CreateCompatibleDC(hdc);
|
hMemDC = CreateCompatibleDC(hdc);
|
||||||
if (!hMemBitmap || cx > bmx || cy > bmy) {
|
if (!hMemBitmap || cx > bmx || cy > bmy) {
|
||||||
if (hMemBitmap)
|
if (hMemBitmap)
|
||||||
DeleteObject(hMemBitmap);
|
if (!DeleteObject(hMemBitmap))
|
||||||
|
MessageBox(m_hwnd, L"FAILED TO DELETE BITMAP", NULL, 0);
|
||||||
bmx = cx + 50;
|
bmx = cx + 50;
|
||||||
bmy = cy + 50;
|
bmy = cy + 50;
|
||||||
hMemBitmap = CreateCompatibleBitmap(hdc, bmx, bmy);
|
hMemBitmap = CreateCompatibleBitmap(hdc, bmx, bmy);
|
||||||
|
@ -488,6 +489,7 @@ void PianoControl::OnPaint()
|
||||||
BitBlt(hdc, x, y, cx, cy, hMemDC, x, y, SRCCOPY);
|
BitBlt(hdc, x, y, cx, cy, hMemDC, x, y, SRCCOPY);
|
||||||
|
|
||||||
SelectObject(hMemDC, hbmPrev);
|
SelectObject(hMemDC, hbmPrev);
|
||||||
|
ps.hdc = hdc;
|
||||||
} else
|
} else
|
||||||
PaintContent(&ps);
|
PaintContent(&ps);
|
||||||
EndPaint(m_hwnd, &ps);
|
EndPaint(m_hwnd, &ps);
|
||||||
|
|
Loading…
Reference in a new issue