#include "stdafx.h" #include "BaseSetPage.h" #include "Common.h" CBaseSetPage::CBaseSetPage(UINT nIDTemplate, CWnd *pParent) : CDialogEx(nIDTemplate, pParent) { m_crBkgnd = SETPAGE_BACKGROUND_COLOR; m_hbrBkgnd = nullptr; } CBaseSetPage::~CBaseSetPage() { if (m_hbrBkgnd != nullptr) { ::DeleteObject(m_hbrBkgnd); } } BEGIN_MESSAGE_MAP(CBaseSetPage, CDialogEx) ON_WM_CTLCOLOR() ON_WM_NCLBUTTONDOWN() ON_WM_NCRBUTTONDOWN() END_MESSAGE_MAP() HBRUSH CBaseSetPage::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor); if (m_hbrBkgnd == nullptr) { m_hbrBkgnd = CreateSolidBrush(m_crBkgnd); } if (nCtlColor == CTLCOLOR_STATIC) { pDC->SetBkColor(m_crBkgnd); } else if (nCtlColor == CTLCOLOR_EDIT || nCtlColor == CTLCOLOR_LISTBOX) { pDC->SetBkColor(m_crBkgnd); return m_hbrBkgnd; } return m_hbrBkgnd; } void CBaseSetPage::OnApply() { } void CBaseSetPage::OnModify() { GetParent()->SendMessageA(ID_MSG_PAGE_MODIFY); }