return CDialog::PreTranslateMessage(pMsg);
}
void CMyDlg::MoveIcon(UINT Direction) /*实现图形的移动*/
{
CClientDC dc(this);
PlayEnhMetaFile(dc.m_hDC,maze.hemf,&rect);
switch (Direction)
{
case VK_UP: /*在新位置重画小动物*/
maze.current_y--;
rect2.top=rect.top + nHeight*maze.current_y/maze.ySize;
rect2.bottom = rect2.top + nHeight/maze.ySize;
PlayEnhMetaFile(dc.m_hDC,maze.hemf2,&rect2);
break;
case VK_DOWN:
maze.current_y++;
rect2.top=rect.top + nHeight*maze.current_y/maze.ySize;
rect2.bottom = rect2.top + nHeight/maze.ySize;
PlayEnhMetaFile(dc.m_hDC,maze.hemf2,&rect2);
break;
case VK_LEFT:
maze.current_x--;
rect2.left=rect.left + nWidth*maze.current_x/maze.xSize;
rect2.right = rect2.left + nWidth/maze.xSize;
PlayEnhMetaFile(dc.m_hDC,maze.hemf2,&rect2);
break;
case VK_RIGHT:
maze.current_x++;
rect2.left=rect.left + nWidth*maze.current_x/maze.xSize;
rect2.right = rect2.left + nWidth/maze.xSize;
PlayEnhMetaFile(dc.m_hDC,maze.hemf2,&rect2);
break;
default:
break;
}
|