📄 controls.cs
字号:
{
#region 判断四个特殊按钮
//判断第一个按钮
if (paneList == 0 && ((Pane)_arrayList[paneList]).State != "marker")
{
((Pane)_arrayList[paneList]).State = "open";
((Pane)_arrayList[paneList])._button.FlatStyle = FlatStyle.Popup;
((Pane)_arrayList[paneList])._button.Enabled = false;
AddImage(paneList);
if (((Pane)_arrayList[paneList]).PaneNumber == 0 )
{
if (((Pane)_arrayList[paneList + 1]).IsMine == false && ((Pane)_arrayList[paneList + 1]).State != "open")
{
DisplayAround(paneList + 1);
}
if (((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber))]).IsMine == false && ((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber))]).State != "open")
{
DisplayAround(paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)));
}
if (((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).IsMine == false && ((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).State != "open")
{
DisplayAround(paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1);
}
}
return;
}
//判断第一列的最后一个按钮
if (paneList == (Math.Sqrt(_buttonNumber) - 1) && ((Pane)_arrayList[paneList]).State != "marker")
{
((Pane)_arrayList[paneList]).State = "open";
((Pane)_arrayList[paneList])._button.FlatStyle = FlatStyle.Popup;
((Pane)_arrayList[paneList])._button.Enabled = false;
AddImage(paneList);
if (((Pane)_arrayList[paneList]).PaneNumber == 0)
{
if (((Pane)_arrayList[paneList - 1]).IsMine == false && ((Pane)_arrayList[paneList - 1]).State != "open")
{
DisplayAround(paneList - 1);
}
if (((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber))]).IsMine == false && ((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber))]).State != "open")
{
DisplayAround(paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)));
}
if (((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).IsMine == false && ((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).State != "open")
{
DisplayAround(paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1);
}
}
return;
}
//判断第一行的最后一个按钮
if (paneList == Math.Sqrt(_buttonNumber) * (Math.Sqrt(_buttonNumber) - 1) && ((Pane)_arrayList[paneList]).State != "marker")
{
((Pane)_arrayList[paneList]).State = "open";
((Pane)_arrayList[paneList])._button.FlatStyle = FlatStyle.Popup;
((Pane)_arrayList[paneList])._button.Enabled = false;
AddImage(paneList);
if (((Pane)_arrayList[paneList]).PaneNumber == 0)
{
if (((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber))]).IsMine == false && ((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber))]).State != "open")
{
DisplayAround(paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)));
}
if (((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).IsMine == false && ((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).State != "open")
{
DisplayAround(paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1);
}
if (((Pane)_arrayList[paneList + 1]).IsMine == false && ((Pane)_arrayList[paneList + 1]).State != "open")
{
DisplayAround(paneList + 1);
}
}
return;
}
//判断最后一个按扭
if (paneList == _buttonNumber - 1 && ((Pane)_arrayList[paneList]).State != "marker")
{
((Pane)_arrayList[paneList]).State = "open";
((Pane)_arrayList[paneList])._button.FlatStyle = FlatStyle.Popup;
((Pane)_arrayList[paneList])._button.Enabled = false;
AddImage(paneList);
if (((Pane)_arrayList[paneList]).PaneNumber == 0)
{
if (((Pane)_arrayList[paneList - 1]).IsMine == false && ((Pane)_arrayList[paneList - 1]).State != "open")
{
DisplayAround(paneList - 1);
}
if (((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber))]).IsMine == false && ((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber))]).State != "open")
{
DisplayAround(paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)));
}
if (((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).IsMine == false && ((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).State != "open")
{
DisplayAround(paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1);
}
}
return;
}
#endregion
#region 判断四条特殊的边
//判断左边的一列
if (paneList / Convert.ToInt32(Math.Sqrt(_buttonNumber)) == 0 && paneList != 0 && paneList != (Math.Sqrt(_buttonNumber) - 1) && ((Pane)_arrayList[paneList]).State != "marker")
{
((Pane)_arrayList[paneList]).State = "open";
((Pane)_arrayList[paneList])._button.FlatStyle = FlatStyle.Popup;
((Pane)_arrayList[paneList])._button.Enabled = false;
AddImage(paneList);
if (((Pane)_arrayList[paneList]).PaneNumber == 0)
{
if (((Pane)_arrayList[paneList + 1]).IsMine == false && ((Pane)_arrayList[paneList + 1]).State != "open")
{
DisplayAround(paneList + 1);
}
if (((Pane)_arrayList[paneList - 1]).IsMine == false && ((Pane)_arrayList[paneList - 1]).State != "open")
{
DisplayAround(paneList - 1);
}
if (((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber))]).IsMine == false && ((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber))]).State != "open")
{
DisplayAround(paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)));
}
if (((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).IsMine == false && ((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).State != "open")
{
DisplayAround(paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1);
}
if (((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).IsMine == false && ((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).State != "open")
{
DisplayAround(paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1);
}
}
return;
}
//判断右边的一列
if (paneList > Math.Sqrt(_buttonNumber) * (Math.Sqrt(_buttonNumber) - 1) && paneList != (Math.Sqrt(_buttonNumber) - 1) && ((Pane)_arrayList[paneList]).State != "marker")
{
((Pane)_arrayList[paneList]).State = "open";
((Pane)_arrayList[paneList])._button.FlatStyle = FlatStyle.Popup;
((Pane)_arrayList[paneList])._button.Enabled = false;
AddImage(paneList);
if (((Pane)_arrayList[paneList]).PaneNumber == 0)
{
if (((Pane)_arrayList[paneList + 1]).IsMine == false && ((Pane)_arrayList[paneList + 1]).State != "open")
{
DisplayAround(paneList + 1);
}
if (((Pane)_arrayList[paneList - 1]).IsMine == false && ((Pane)_arrayList[paneList - 1]).State != "open")
{
DisplayAround(paneList - 1);
}
if (((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber))]).IsMine == false && ((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber))]).State != "open")
{
DisplayAround(paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)));
}
if (((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).IsMine == false && ((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).State != "open")
{
DisplayAround(paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1);
}
if (((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).IsMine == false && ((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).State != "open")
{
DisplayAround(paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1);
}
}
return;
}
//判断上边的一行
for (int q = Convert.ToInt32(Math.Sqrt(_buttonNumber)); q < Math.Sqrt(_buttonNumber) * (Math.Sqrt(_buttonNumber) - 1); q += Convert.ToInt32(Math.Sqrt(_buttonNumber)))
{
if (paneList == q && ((Pane)_arrayList[paneList]).State != "marker")
{
((Pane)_arrayList[paneList]).State = "open";
((Pane)_arrayList[paneList])._button.FlatStyle = FlatStyle.Popup;
((Pane)_arrayList[paneList])._button.Enabled = false;
AddImage(paneList);
if (((Pane)_arrayList[paneList]).PaneNumber == 0)
{
if (((Pane)_arrayList[paneList + 1]).IsMine == false && ((Pane)_arrayList[paneList + 1]).State != "open")
{
DisplayAround(paneList + 1);
}
if (((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber))]).IsMine == false && ((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber))]).State != "open")
{
DisplayAround(paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)));
}
if (((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).IsMine == false && ((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).State != "open")
{
DisplayAround(paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1);
}
if (((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).IsMine == false && ((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1]).State != "open")
{
DisplayAround(paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) + 1);
}
if (((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber))]).IsMine == false && ((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber))]).State != "open")
{
DisplayAround(paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)));
}
}
return;
}
}
//判断下边的一行
for (int q = Convert.ToInt32(2 * Math.Sqrt(_buttonNumber) - 1); q <= (Math.Sqrt(_buttonNumber) * (Math.Sqrt(_buttonNumber) - 1) - 1); q += Convert.ToInt32(Math.Sqrt(_buttonNumber)))
{
if (paneList == q && ((Pane)_arrayList[paneList]).State != "marker")
{
((Pane)_arrayList[paneList]).State = "open";
((Pane)_arrayList[paneList])._button.FlatStyle = FlatStyle.Popup;
((Pane)_arrayList[paneList])._button.Enabled = false;
AddImage(paneList);
if (((Pane)_arrayList[paneList]).PaneNumber == 0)
{
if (((Pane)_arrayList[paneList - 1]).IsMine == false && ((Pane)_arrayList[paneList - 1]).State != "open")
{
DisplayAround(paneList - 1);
}
if (((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber))]).IsMine == false && ((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber))]).State != "open")
{
DisplayAround(paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)));
}
if (((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).IsMine == false && ((Pane)_arrayList[paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).State != "open")
{
DisplayAround(paneList + Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1);
}
if (((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).IsMine == false && ((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1]).State != "open")
{
DisplayAround(paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)) - 1);
}
if (((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber))]).IsMine == false && ((Pane)_arrayList[paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber))]).State != "open")
{
DisplayAround(paneList - Convert.ToInt32(Math.Sqrt(_buttonNumber)));
}
}
return;
}
}
#endregion
#region 判断中间的方格
if(((Pane)_arrayList[paneList]).State != "marker")
{
//中间的
((Pane)_arrayList[paneList]).State = "open";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -