mirror of
https://github.com/quantum5/MusicKeyboard.git
synced 2025-04-24 13:11:58 -04:00
Hid piano during resizing to avoid slowness, and flickering on Aero.
This commit is contained in:
parent
e0ea6c6072
commit
cf4aa335c6
|
@ -35,7 +35,10 @@ public:
|
||||||
|
|
||||||
virtual void SetKeyText(int key, LPCWSTR text);
|
virtual void SetKeyText(int key, LPCWSTR text);
|
||||||
virtual LPCWSTR GetKeyText(int key);
|
virtual LPCWSTR GetKeyText(int key);
|
||||||
|
|
||||||
|
virtual void DisableDraw();
|
||||||
|
virtual void EnableDraw();
|
||||||
|
|
||||||
virtual void SetBackground(HBRUSH background) { hBackground = background; }
|
virtual void SetBackground(HBRUSH background) { hBackground = background; }
|
||||||
virtual HBRUSH GetBackground() { return hBackground; }
|
virtual HBRUSH GetBackground() { return hBackground; }
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ static LPWSTR keychars =
|
||||||
L"\"-\0" // D5
|
L"\"-\0" // D5
|
||||||
L"]\0" // D#5
|
L"]\0" // D#5
|
||||||
L"=\x21b5\0" // E5
|
L"=\x21b5\0" // E5
|
||||||
L"\x2190\0" // F5
|
L"\x2190\\\0" // F5
|
||||||
;
|
;
|
||||||
|
|
||||||
static WORD frequency[] = {
|
static WORD frequency[] = {
|
||||||
|
@ -740,9 +740,11 @@ LRESULT MainWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
return 0;
|
return 0;
|
||||||
case WM_ENTERSIZEMOVE:
|
case WM_ENTERSIZEMOVE:
|
||||||
SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_COMPOSITED);
|
SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_COMPOSITED);
|
||||||
|
piano->DisableDraw();
|
||||||
return 0;
|
return 0;
|
||||||
case WM_EXITSIZEMOVE:
|
case WM_EXITSIZEMOVE:
|
||||||
SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) & ~WS_EX_COMPOSITED);
|
SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) & ~WS_EX_COMPOSITED);
|
||||||
|
piano->EnableDraw();
|
||||||
return 0;
|
return 0;
|
||||||
case MMWM_NOTEID: {
|
case MMWM_NOTEID: {
|
||||||
int note = wParam + 54;
|
int note = wParam + 54;
|
||||||
|
|
|
@ -495,6 +495,15 @@ void PianoControl::OnPaint()
|
||||||
EndPaint(m_hwnd, &ps);
|
EndPaint(m_hwnd, &ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PianoControl::DisableDraw() {
|
||||||
|
SendMessage(m_hwnd, WM_SETREDRAW, FALSE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PianoControl::EnableDraw() {
|
||||||
|
SendMessage(m_hwnd, WM_SETREDRAW, TRUE, 0);
|
||||||
|
RedrawWindow(m_hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT PianoControl::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT PianoControl::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ void Window::Register()
|
||||||
wc.hInstance = GetInstance();
|
wc.hInstance = GetInstance();
|
||||||
wc.hIcon = GetIcon();
|
wc.hIcon = GetIcon();
|
||||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
wc.hbrBackground = CreateSolidBrush(RGB(0xF0, 0xF0, 0xF0));
|
wc.hbrBackground = (HBRUSH) (COLOR_3DFACE + 1);
|
||||||
wc.lpszMenuName = NULL;
|
wc.lpszMenuName = NULL;
|
||||||
wc.lpszClassName = ClassName();
|
wc.lpszClassName = ClassName();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue