三缓冲
BOOL?Cmfc_GDIDlg::OnEraseBkgnd(CDC*?pDC) { ????//?TODO:?Add?your?message?handler?code?here?and/or?call?default //兩個兼容DC CDC?MemDC1; CDC?MemDC2; MemDC1.CreateCompatibleDC(NULL); MemDC2.CreateCompatibleDC(NULL); //加載位圖 CBitmap?bitmap; BITMAP?BMInfo; bitmap.LoadBitmapW(IDB_BITMAP1); bitmap.GetBitmap(&BMInfo); //窗口大小 CRect?rect; GetClientRect(rect); MemDC1.SelectObject(&bitmap); //縮放到第二內存DC CBitmap?Membitmap; Membitmap.CreateCompatibleBitmap(pDC,rect.Width(),rect.Height()); MemDC2.SelectObject(&Membitmap); MemDC2.StretchBlt(0,0,rect.Width(),rect.Height(),&MemDC1,0,0,BMInfo.bmWidth?,BMInfo.bmHeight,SRCCOPY); MemDC2.TextOutW(0,0,L"我是固定文本"); //最后在屏幕顯示再來 //pDC->StretchBlt(0,0,rect.Width(),rect.Height(),&MemDC2,0,0,BMInfo.bmWidth?,BMInfo.bmHeight,SRCCOPY); pDC->BitBlt(0,0,rect.Width(),rect.Height(),&MemDC2,0,0,SRCCOPY); pDC->TextOutW(100,100,L"時間顯示"); bitmap.DeleteObject(); MemDC1.DeleteDC(); MemDC2.DeleteDC(); return?true; //return?CDialog::On
轉載于:https://www.cnblogs.com/chenzuoyou/p/3346079.html
總結
- 上一篇: Android 之 Shape (圆角输
- 下一篇: 关于“无法解析的外部符号”和“该符号在函