void CMineWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
.............
.............
Invalidate();
}
void CMineWnd::OnPaint()
{
CPaintDC dc(this); // device context for painting CDC dcMemory;
CBitmap bitmap; CBitmap bitsoubimap;
CDC cdc1;
bitsoubimap.LoadBitmap(IDB_BITMAP1);
cdc1.CreateCompatibleDC(NULL);
cdc1.SelectObject(&bitsoubimap);
if(!dc.IsPrinting())
{
if(dcMemory.CreateCompatibleDC(&dc))
{
if(bitmap.CreateCompatibleBitmap(&dc,256,256))
{
dcMemory.SelectObject(&bitmap);
for(int i=0;i<16;i++)
{
for(int j=0;j<16;j++)
{
int state = m_MineCellArray[i][j].state;
dcMemory.StretchBlt(j*16,i*16,16,16,&cdc1,0,16*state,16,16,SRCCOPY );
}
}
}
}
dc.BitBlt(0,0,256,256,&dcMemory,0,0,SRCCOPY);
}
}
为什么会有闪烁显现?如何解决?
{
.............
.............
Invalidate();
}
void CMineWnd::OnPaint()
{
CPaintDC dc(this); // device context for painting CDC dcMemory;
CBitmap bitmap; CBitmap bitsoubimap;
CDC cdc1;
bitsoubimap.LoadBitmap(IDB_BITMAP1);
cdc1.CreateCompatibleDC(NULL);
cdc1.SelectObject(&bitsoubimap);
if(!dc.IsPrinting())
{
if(dcMemory.CreateCompatibleDC(&dc))
{
if(bitmap.CreateCompatibleBitmap(&dc,256,256))
{
dcMemory.SelectObject(&bitmap);
for(int i=0;i<16;i++)
{
for(int j=0;j<16;j++)
{
int state = m_MineCellArray[i][j].state;
dcMemory.StretchBlt(j*16,i*16,16,16,&cdc1,0,16*state,16,16,SRCCOPY );
}
}
}
}
dc.BitBlt(0,0,256,256,&dcMemory,0,0,SRCCOPY);
}
}
为什么会有闪烁显现?如何解决?
直接返回是什么意思?
BOOL CMineWnd::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
return CFrameWnd::OnEraseBkgnd(pDC);
}