
LRESULT CDIBDisplayView::OnDoRealize(WPARAM wParam, LPARAM)
{
CDIBDisplayDoc* pDoc = GetDocument();
CPalette* pPal = pDoc->GetDocPalette();
CMainFrame* pAppFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd;
CClientDC appDC(pAppFrame); //这里为什么是用主框架的DC ???
CPalette* oldPalette = appDC.SelectPalette(pPal,((HWND)wParam)!=m_hWnd);
UINT nColorsChanged = appDC.RealizePalette();
pDoc->UpdateAllViews(NULL);
appDC.SelectPalette(oldPalette, TRUE);
return 0L;
}
代码中,为什么使用CClientDC appDC(pAppFrame) 的设备环境?而不用其他的比如CClientDC appDC(this);?{
CDIBDisplayDoc* pDoc = GetDocument();
CPalette* pPal = pDoc->GetDocPalette();
CMainFrame* pAppFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd;
CClientDC appDC(pAppFrame); //这里为什么是用主框架的DC ???
CPalette* oldPalette = appDC.SelectPalette(pPal,((HWND)wParam)!=m_hWnd);
UINT nColorsChanged = appDC.RealizePalette();
pDoc->UpdateAllViews(NULL);
appDC.SelectPalette(oldPalette, TRUE);
return 0L;
}
或者说代码这么处理有什么好处?
谢谢了!~~~