From 74a3a445625772564c48c6802837308e38c1b423 Mon Sep 17 00:00:00 2001 From: Quantum Date: Fri, 14 Jun 2013 19:30:29 -0400 Subject: [PATCH] Cleaned up window painting and fixed colours. --- include/MainWindow.hpp | 2 -- src/MainWindow.cpp | 21 ++------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/include/MainWindow.hpp b/include/MainWindow.hpp index 85ec4ac..5a23d35 100644 --- a/include/MainWindow.hpp +++ b/include/MainWindow.hpp @@ -18,8 +18,6 @@ protected: LRESULT OnCreate(); LRESULT OnDestroy(); bool Play(WPARAM wCode, LPARAM lParam, bool down); - void OnPaint(); - void PaintContent(PAINTSTRUCT *pps); BOOL WinRegisterClass(WNDCLASS *pwc); WORD GetQWERTYKeyCode(WORD wKeyCode); WORD GetRealKeyCode(WORD wQWERTYCode); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 78bc7dc..4ae0dec 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -58,6 +58,7 @@ int dnslen(LPWSTR dns) BOOL MainWindow::WinRegisterClass(WNDCLASS *pwc) { pwc->style = CS_HREDRAW | CS_VREDRAW; + pwc->hbrBackground = (HBRUSH) (COLOR_3DFACE + 1); return __super::WinRegisterClass(pwc); } @@ -127,10 +128,7 @@ LRESULT MainWindow::OnCreate() MessageBox(m_hwnd, L"Failed to open MIDI device!", L"Fatal Error", MB_ICONERROR); this->piano = PianoControl::Create(NULL, m_hwnd, WS_VISIBLE | WS_CHILD, 0, 0, 0, 0); - this->piano->SetBackground( - (HBRUSH) DefWindowProc(m_hwnd, WM_CTLCOLORSTATIC, - (WPARAM) GetDC(m_volumeLabel), - (LPARAM) m_volumeLabel)); + this->piano->SetBackground(GetSysColorBrush(COLOR_3DFACE)); { keymap[VK_OEM_3] = 54; // `~ key @@ -204,18 +202,6 @@ HICON MainWindow::GetIcon() return LoadIcon(GetInstance(), MAKEINTRESOURCE(RID_ICON)); } -void MainWindow::PaintContent(PAINTSTRUCT *pps) -{ -} - -void MainWindow::OnPaint() -{ - PAINTSTRUCT ps; - BeginPaint(m_hwnd, &ps); - PaintContent(&ps); - EndPaint(m_hwnd, &ps); -} - WORD MainWindow::GetQWERTYKeyCode(WORD wKeyCode) { if (isQWERTY) @@ -304,9 +290,6 @@ LRESULT MainWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NCDESTROY: PostQuitMessage(0); break; - case WM_PAINT: - OnPaint(); - return 0; case WM_SIZE: { RECT client; HDWP hdwp;