void CSimplePanelDlg::InitPannel() { CDC* pDC = GetDC(); char curDir[160] = {0}; WCHAR wcurDir[160] = {0}; GetCurrentDirectory(160, curDir); ZeroMemory(wcurDir, sizeof(wcurDir)); CString strImPath = curDir; strImPath += _T("\\Res\\linepannel_simple.png"); MultiByteToWideChar(CP_ACP, 0, (char*)(LPCTSTR)strImPath, strImPath.GetLength(), wcurDir, 160); m_pImLineBK = new Gdiplus::Image(wcurDir); int nHeight = m_pImLineBK->GetHeight(); int nWidth = m_pImLineBK->GetWidth(); CRect rc1(0, 46, 539, nHeight + 46); CEsayMemDC* pMemDC = new CEsayMemDC(*pDC, rc1); m_vecMemDC.push_back(pMemDC); CRect rc2(542, 46, 1080, nHeight + 46); pMemDC = new CEsayMemDC(*pDC, rc2); m_vecMemDC.push_back(pMemDC); CRect rc3(0, nHeight + 52, 540, nHeight*2 + 52); pMemDC = new CEsayMemDC(*pDC, rc3); m_vecMemDC.push_back(pMemDC); CRect rc4(542, nHeight + 52, 1080, nHeight*2 + 52); pMemDC = new CEsayMemDC(*pDC, rc4); m_vecMemDC.push_back(pMemDC); CRect rc5(0, nHeight*2 + 58, 540, nHeight*3 + 58); pMemDC = new CEsayMemDC(*pDC, rc5); m_vecMemDC.push_back(pMemDC); CRect rc6(542, nHeight*2 + 58, 1080, nHeight*3 + 58); pMemDC = new CEsayMemDC(*pDC, rc6); m_vecMemDC.push_back(pMemDC); ReleaseDC(pDC); }
void CChildView::OnPaint() { CPaintDC dcPaint( this ); CExtPaintManager::stat_ExcludeChildAreas( dcPaint.GetSafeHdc(), GetSafeHwnd() ); CExtMemoryDC dc( &dcPaint ); CGdiObject * pOld0, * pOld1; CExtWndShadow _shadow; WORD _PatternBits0[8],_PatternBits1[8]; for( INT iPatternLine=0; iPatternLine < 8; iPatternLine++ ) { _PatternBits0[iPatternLine] = ( iPatternLine & 1 ) ? WORD(0xFFFF) : WORD( ~ ( 5<<iPatternLine ) ) ; _PatternBits1[iPatternLine] = ( iPatternLine & 1 ) ? WORD(0xFFFF) : WORD( ~ ( 1<<(8-iPatternLine) ) ) ; } CBitmap bmpPattern0,bmpPattern1; CBrush brPattern0,brPattern1; VERIFY( bmpPattern0.CreateBitmap(8,8,1,1,_PatternBits0) ); VERIFY( bmpPattern1.CreateBitmap(8,8,1,1,_PatternBits1) ); VERIFY( brPattern0.CreatePatternBrush(&bmpPattern0) ); VERIFY( brPattern1.CreatePatternBrush(&bmpPattern1) ); CRect rcPattern0(10,10,180,150), rcPattern1(40,30,80,200); dc.FillRect(rcPattern0,&brPattern0); _shadow.Paint( dc, rcPattern0, CRect(0,0,0,0), CRect(0,0,0,0), CExtWndShadow::DEF_SHADOW_SIZE, CExtWndShadow::DEF_BRIGHTNESS_MIN, CExtWndShadow::DEF_BRIGHTNESS_MAX, false ); pOld0 = dc.SelectStockObject( NULL_BRUSH ); pOld1 = dc.SelectStockObject( BLACK_PEN ); dc.Rectangle( rcPattern0 ); if( pOld0 != NULL ) dc.SelectObject( pOld0 ); if( pOld1 != NULL ) dc.SelectObject( pOld1 ); dc.FillRect(rcPattern1,&brPattern1); _shadow.Paint( dc, rcPattern1, CRect(0,0,0,0), CRect(0,0,0,0), CExtWndShadow::DEF_SHADOW_SIZE, CExtWndShadow::DEF_BRIGHTNESS_MIN, CExtWndShadow::DEF_BRIGHTNESS_MAX, false ); pOld0 = dc.SelectStockObject( NULL_BRUSH ); pOld1 = dc.SelectStockObject( BLACK_PEN ); dc.Rectangle( rcPattern1 ); if( pOld0 != NULL ) dc.SelectObject( pOld0 ); if( pOld1 != NULL ) dc.SelectObject( pOld1 ); CRect rc0(20,50,160,80); CRect rc1(160,50,210,80); CRect rc2(rc0.left,rc0.top,rc1.right,rc1.bottom); COLORREF clrLeft = RGB(0,255,0); COLORREF clrMiddle = RGB(255,255,0); COLORREF clrRight = RGB(255,0,0); CExtPaintManager::stat_PaintGradientRect( dc, rc0, clrLeft, clrMiddle ); CExtPaintManager::stat_PaintGradientRect( dc, rc1, clrMiddle,clrRight ); _shadow.Paint( dc, rc2, CRect(0,0,0,0), CRect(0,0,0,0), CExtWndShadow::DEF_SHADOW_SIZE, CExtWndShadow::DEF_BRIGHTNESS_MIN, CExtWndShadow::DEF_BRIGHTNESS_MAX, false ); pOld0 = dc.SelectStockObject( NULL_BRUSH ); pOld1 = dc.SelectStockObject( BLACK_PEN ); dc.Rectangle(rc2); if( pOld0 != NULL ) dc.SelectObject( pOld0 ); if( pOld1 != NULL ) dc.SelectObject( pOld1 ); CRect rc3(120,40,150,80); CRect rc4(120,80,150,160); CRect rc5(rc3.left,rc3.top,rc4.right,rc4.bottom); COLORREF clrUpper = RGB(255,0,255); COLORREF clrMiddleV = RGB(255,255,255); COLORREF clrLower = RGB(0,0,255); CExtPaintManager::stat_PaintGradientRect( dc, rc3, clrMiddleV, clrUpper, TRUE ); CExtPaintManager::stat_PaintGradientRect( dc, rc4, clrLower, clrMiddleV, TRUE ); _shadow.Paint( dc, rc5, CRect(0,0,0,0), CRect(0,0,0,0), CExtWndShadow::DEF_SHADOW_SIZE, CExtWndShadow::DEF_BRIGHTNESS_MIN, CExtWndShadow::DEF_BRIGHTNESS_MAX, false ); pOld0 = dc.SelectStockObject( NULL_BRUSH ); pOld1 = dc.SelectStockObject( BLACK_PEN ); dc.Rectangle(rc5); if( pOld0 != NULL ) dc.SelectObject( pOld0 ); if( pOld1 != NULL ) dc.SelectObject( pOld1 ); }