private void ReFindPath()
 {
     //m_aPath = null;
     //m_nPathLen = 0;
     //m_nPos = 0;
     //清除前面的路径标记
     for (int i = 0; i < m_nPathLen - 2; i += 2)
     {
         byte _data = 0;
         DllAPI.ReadMapByte(m_aPath[i], m_aPath[i + 1], ref _data);
         if (_data == (byte)BlockType.Blank)
         {
             RePaint(m_aPath[i], m_aPath[i + 1], (byte)BlockType.Blank);
         }
     }
     //
     DllAPI.setRobotPoint(m_pntRobot.X, m_pntRobot.Y);
     DllAPI.setEndPoint(m_pntEndPoint.X, m_pntEndPoint.Y);
     if (DllAPI.RobotPathPlan(ref m_aPath, ref m_nPathLen) != 0)
     {
         return;
     }
     //显示路径标记
     for (int i = 0; i < m_nPathLen - 2; i += 2)
     {
         RePaint(m_aPath[i], m_aPath[i + 1], (byte)BlockType.Path);
     }
     this.Invalidate();
     this.Update();
 }
        private void UpdateBlock(int x, int y, BlockType data)
        {
            byte _data = 0;

            if (x < 0 || x >= m_nWidth || y < 0 || y >= m_nHeight)
            {
                return;
            }
            DllAPI.ReadMapByte(x, y, ref _data);
            if (data == BlockType.Robot)
            {
                if (x == m_pntEndPoint.X && y == m_pntEndPoint.Y || _data != (byte)BlockType.Blank)
                {
                    return;
                }
                RePaint(m_pntRobot.X, m_pntRobot.Y, (byte)BlockType.Blank);
                m_pntRobot.X = x;
                m_pntRobot.Y = y;
                RePaint(x, y, (byte)BlockType.Robot);
                DllAPI.setRobotPoint(x, y);
            }
            else if (data == BlockType.Goal)
            {
                if (x == m_pntRobot.X && y == m_pntRobot.Y || _data != (byte)BlockType.Blank)
                {
                    return;
                }
                RePaint(m_pntEndPoint.X, m_pntEndPoint.Y, (byte)BlockType.Blank);
                m_pntEndPoint.X = x;
                m_pntEndPoint.Y = y;
                RePaint(x, y, (byte)BlockType.Goal);
                DllAPI.setEndPoint(x, y);
            }
            else if (data == BlockType.Blank)
            {
                if (x == m_pntRobot.X && y == m_pntRobot.Y || x == m_pntEndPoint.X && y == m_pntEndPoint.Y)
                {
                    return;
                }
                RePaint(x, y, (byte)BlockType.Blank);
                DllAPI.UpdateMap(x, y, (byte)data);
            }
            else if (data == BlockType.Wall)
            {
                if (x == m_pntRobot.X && y == m_pntRobot.Y || x == m_pntEndPoint.X && y == m_pntEndPoint.Y)
                {
                    return;
                }
                RePaint(x, y, (byte)BlockType.Wall);
                DllAPI.UpdateMap(x, y, (byte)BlockType.Wall);
            }
            this.Invalidate();
            this.Update();
        }