GDI+ 双缓冲

来源:互联网 发布:优化探究 编辑:程序博客网 时间:2024/06/08 14:22
BOOL CXXXDlg::OnEraseBkgnd(CDC *pDC){    CRect  rect;    this->GetClientRect(rect);    if(!m_pBkImage)                                                          //定义的一个成员变量    {        m_pBkImage = new Image(_T("main_frame.png"));    }    Bitmap bmp(rect.right, rect.bottom);    Graphics bmpGraphics(&bmp);    bmpGraphics.SetSmoothingMode(SmoothingModeAntiAlias);    bmpGraphics.DrawImage(m_pBkImage, 0, 0, rect.Width(), rect.Height());    //Drawing on bitmap    Graphics graphics(pDC->m_hDC);                                           //Drawing on DC    CachedBitmap cachedBmp(&bmp,&graphics);    graphics.DrawCachedBitmap(&cachedBmp, 0, m_iCaptionH);    graphics.ReleaseHDC(pDC->m_hDC);    return TRUE;}