当前位置: 代码迷 >> .NET分析设计 >> 递归调用改成循环
  详细解决方案

递归调用改成循环

热度:545   发布时间:2016-05-01 22:41:43.0
递归调用改为循环
我就是想把这个最上面的那个函数改成循环的,请问怎么改呢???在线等答案啊、、、、、 

public void DisplayArround(Pane currentPane)
        {
            if (currentPane.State == PaneState.Opened || currentPane.HasMine)
            {
                    return;
            }
            currentPane.Open();

            List<Pane> panes = this.GetAroundPanes(currentPane);
            foreach (Pane p in panes)
            {
                if (this.GetAroundMineCount(p) == 0)
                {
                    DisplayArround(p);
                }
                else
                {
                    if (p.State != PaneState.Opened && !currentPane.HasMine)
                    {
                        p.Open();
                    }
                }
            }
        }


 private List<Pane> GetAroundPanes(Pane pane)
        {
            List<Pane> result = new List<Pane>();
            int paneWidth = pane.Width;
            int paneHeight = pane.Height;
            foreach (Pane p in this.Controls)
            {
                if (p.Top == pane.Top && Math.Abs(pane.Left - p.Left) == paneWidth
                   ||
                    p.Left == pane.Left & Math.Abs(pane.Top - p.Top) == paneHeight
                   ||
  相关解决方案