日期:2014-05-18 浏览次数:20717 次
for (int r = 3; r < dataGrid.Rows.Count; r++) { for (int c = 2; c <= 4; c++) { var ssq = new List<int>(3) {Convert.ToInt32(listGrid[r - 2,c])}; var sq = new List<int>(3) {Convert.ToInt32(listGrid[r - 1, c])}; var bq = new List<int>(3) {Convert.ToInt32(listGrid[r, c])}; } }
for (int r = 4; r < dataGrid.Rows.Count; r++) { List<int> ssq = new List<int>(3); ssq.Add(Convert.ToInt32(listGrid[r - 2, 2])); ssq.Add(Convert.ToInt32(listGrid[r - 2, 3])); ssq.Add(Convert.ToInt32(listGrid[r - 2, 4])); foreach (int val in ssq) { listGrid[r, 16] = val; } }
------解决方案--------------------
for (int c = 2; c <= 4; c++)
{
List<int> ssq = new List<int>();
ssq.Add(Convert.ToInt32(listGrid[2, c]));
if (ssq.Contains(3))
{
listGrid[2, 16] = "yes"; // 坐标写死,循环就看最后个值了
}
else
{
listGrid[2, 16] = "no";
}
}