BOOL CMFCAppDlg::OnEraseBkgnd(CDC* pDC) { // TODO: 在此添加消息处理程序代码和/或调用默认值 CRect rect; GetClientRect(rect); GCMemDC pDevC(pDC, rect); ///////////////////////////////////////////////////////////////////////////////// // just put something in the background - unrelated to GdipButton ///////////////////////////////////////////////////////////////////////////////// if (m_hBitmap) { pDevC->SelectObject(m_hBitmap); }//*/ ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // Since this function just painted the background into the memory DC, // this is the correct information that can be provided to the buttons ///////////////////////////////////////////////////////////////////////////////// SetButtonBackGrounds(pDevC); ///////////////////////////////////////////////////////////////////////////////// //return TRUE; return CDialogEx::OnEraseBkgnd(pDC); }
BOOL CPreview::OnEraseBkgnd(CDC* pDC) { // TODO: Add your message handler code here and/or call default CDialog::OnEraseBkgnd(pDC); CRect rect; GetClientRect(rect); CMemDC_S pDevC(pDC, rect); ///////////////////////////////////////////////////////////////////////////////// // just put something in the background - unrelated to GdipButton ///////////////////////////////////////////////////////////////////////////////// if (m_hBitmap) { pDevC->SelectObject(m_hBitmap); } ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // Since this function just painted the background into the memory DC, // this is the correct information that can be provided to the buttons ///////////////////////////////////////////////////////////////////////////////// SetButtonBackGrounds(pDevC); ///////////////////////////////////////////////////////////////////////////////// return TRUE; }