关于双缓存刷新问题

太乙 太乙 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
	

void CEREditorView::OnDraw(CDC* pDC)
{
CEREditorDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);

if (first_time)
{
InitDB(pDC);
first_time=FALSE;
}

CRect clientRect;
GetClientRect(&clientRect);
MemDC.FillSolidRect(&clientRect,RGB(255,255,255));
CBrush* mybrush=new CBrush(GetDocument()->color_self);
CPen* pPen = new CPen(PS_SOLID,1,RGB(153,0,51));
pUpdateTool->Update(&MemDC,mybrush,pPen,nFontHeight,nFontWidth,nCurrentFont, pCommandTool->getViewOption());
delete mybrush;
delete pPen;
pDC->BitBlt(0,0,clientRect.Width(),clientRect.Height(),&MemDC,0,0,SRCCOPY);
}



void CEREditorView::InitDB(CDC *pdc)
{
CRect rect(0,0,2000,2000);
// GetClientRect(&rect);
if(!MemDC.CreateCompatibleDC(NULL))
{
::PostQuitMessage(0);
}
MemBitmap.CreateCompatibleBitmap(pdc, rect.Width(), rect.Height());
MemDC.SelectObject(MemBitmap);
}



我这么使用的双缓存,不过还有点儿闪.以前解决过,不过现在给忘了!网上搜了一下,说是要添加以下代码:





BOOL CEREditorView::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
return FALSE;
return CScrollView::OnEraseBkgnd(pDC);
}




问题是,我加了以后还是有些闪烁!请高手指点一下,在此谢过了!!
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
太乙
界面 15,976 成员 115,866 内容