部分代码如下:
void CPaopaotang1Dlg::OnPaint() 
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
   
CPaintDC dc(this);
        CDC memDC;
        CBitmap bitmapmem; memDC.CreateCompatibleDC(&dc);
bitmapmem.CreateCompatibleBitmap(&dc,800,600); memDC.SelectObject(&bitmapmem);


for(int x=0;x<60;x++)
{//CDialog::OnPaint();
DrawBmp(m_bitmap[0]->GetID(),&memDC,&dc);
DrawBmp(m_bitmap[1]->GetID(),&memDC,&dc,RGB(0,0,0),x,0);
dc.BitBlt(0,0,800,600,&memDC,0,0,SRCCOPY);
    
}
bitmapmem.DeleteObject();
// memDC.DeleteDC();
// dc.DeleteDC();
}
}// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CPaopaotang1Dlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}调用函数:
BOOL CPaopaotang1Dlg::PreTranslateMessage(MSG* pMsg) 
{
// TODO: Add your specialized code here and/or call the base class
// if(pMsg->message ==WM_CHAR)
// MessageBox("klj");
if(pMsg->message == WM_KEYDOWN)
{
// MessageBox("SADF");
switch(pMsg->wParam) 
{
case VK_LEFT:
   OnPaint();
break;
case 'A':MessageBox("jasdfkl");
break;
default:;
}
}
return CDialog::PreTranslateMessage(pMsg);

}