日期:2014-05-20  浏览次数:20853 次

递归调用改为循环
我就是想把这个最上面的那个函数改成循环的,请问怎么改呢???在线等答案啊、、、、、 

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
                   ||